home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / help-pc.zip / TABLES.TXT < prev   
Text File  |  1990-11-27  |  91KB  |  2,346 lines

  1. @Tables and Formats used by DOS & BIOS
  2. :bios parameter block:bpb
  3. ^BPB - BIOS Parameter Block
  4.  
  5. %Offset Size         Description
  6.  
  7.    00   word   sector size in bytes
  8.    02   byte   sectors per cluster (allocation unit size)
  9.    03   word   number of reserved sectors
  10.    05   byte   number of FATs on disk
  11.    06   word   number of root directory entries (directory size)
  12.    08   word   number of total sectors; zero if partition > 32Mb
  13.    0A   byte   media descriptor byte  (see MEDIA DESCRIPTOR)
  14.    0B   word   sectors per FAT
  15.    0D   word   sectors per track (DOS 3.0+)
  16.    0F   word   number of heads (DOS 3.0+)
  17.    11   word   number of hidden sectors (DOS 3.0+)
  18.    15   dword  number of total sectors if offset 8 is zero (DOS 4+)
  19.  
  20.  - located in the boot sector at offset 0Bh
  21.  
  22.  - see   BOOT SECTOR
  23. :batch control block:bcb
  24. ^BCB - Batch Control Block (undocumented)
  25.  
  26. ^DOS 2.x thru DOS 3.2  BCB Format
  27.  
  28. %Offset Size                Description
  29.  
  30.    00   byte    unknown
  31.    01   word    if non-zero; segment of control block for active FOR
  32.    03   byte    type of batch command
  33.                   0 - normal batch command
  34.                   1 - FOR-loop active
  35.    04   dword   offset of next command to execute in batch file
  36.    07   word    offset of variable %0 (batch file name)
  37.    09  9 words  offset of %N batch file parameters, 0FFFFh indicates
  38.                 parameter is null
  39.    1C   nbytes  null terminated path and filename of the current
  40.                 batch file immediately followed by command line
  41.                 parameters.  Each parameter %0-%9 plus a CR is
  42.                 appended and resulting string is null terminated.
  43.  
  44.  
  45. ^DOS 3.3  BCB Format
  46.  
  47. %Offset Size                Description
  48.  
  49.    00   byte    unknown
  50.    01   byte    global echo switch, if exec'd by batch CALL-command
  51.                   1 - turn ECHO ON on return to calling batch file
  52.                   0 - turn ECHO OFF on return to calling batch file
  53.    02   word    batch file BCD segment if executed via CALL
  54.                   if zero; batch file was called from command line
  55.                   if non-zero; batch file executed via CALL-command
  56.    04   word    if non-zero; segment of control block for active FOR
  57.    06   byte    type of batch command
  58.                   0 - normal batch command
  59.                   1 - FOR-loop active
  60.    07   dword   offset of next command to execute in batch file
  61.    0B   word    offset of variable %0 (batch file name)
  62.    0D  9words   offset of %N batch file parameters, 0FFFFh indicates
  63.                 parameter is null
  64.    1F  nbytes   null terminated path and filename of the current
  65.                 batch file immediately followed by command line
  66.                 parameters.  Each parameter %0-%9 plus a CR is
  67.                 appended and resulting string is null terminated.
  68.  
  69.  
  70.  - BCB length is variable and depends on the size and count of the
  71.    parameters and fully qualified batch file name
  72.  - the MCB for a BCB has a process Id of the transient portion of
  73.    the latest COMMAND.COM
  74.  - offsets displayed are relative to the BCB segment
  75.  - SHIFT command changes the offsets of the parameters in the table
  76.    at the offsets 0B0h thru 1Ch
  77.  - BCB  of DOS 3.3 is the  same as earlier versions except 3 bytes
  78.    were added after offset 0
  79.  
  80. :bios data area:bda:bios memory:memory map
  81. ^BDA - BIOS Data Area - PC Memory Map
  82.  
  83. %Address Size       Description
  84.  
  85.  00:00 256dwords Interrupt vector table
  86.  30:00 256bytes  Stack area used during post and bootstrap
  87.  40:00   word    COM1 port address
  88.  40:02   word    COM2 port address
  89.  40:04   word    COM3 port address
  90.  40:06   word    COM4 port address
  91.  40:08   word    LPT1 port address
  92.  40:0A   word    LPT2 port address
  93.  40:0C   word    LPT3 port address
  94.  40:0E   word    LPT4 port address (except PS2)
  95.                  Extended BIOS Data Area segment (PS2, see EBDA)
  96.  40:10  2 bytes  Equipment list flags (see also INT 11)
  97.  
  98.      │7│6│5│4│3│2│1│0│ 40:10 (value in INT 11 register AL)
  99.       │ │ │ │ │ │ │ └─ IPL diskette installed
  100.       │ │ │ │ │ │ └── math coprocessor
  101.       │ │ │ │ ├─┼─── old PC system board RAM < 256K
  102.       │ │ │ │ │ └── pointing device installed (PS2)
  103.       │ │ │ │ └─── not used on PS2
  104.       │ │ └─┴──── initial video mode
  105.       └─┴─────── # of diskette drives, less 1
  106.  
  107.      │7│6│5│4│3│2│1│0│ 40:11  (value in INT 11 register AH)
  108.       │ │ │ │ │ │ │ └─ 0 if DMA installed
  109.       │ │ │ │ └─┴─┴── number of serial ports
  110.       │ │ │ └─────── game adapter
  111.       │ │ └──────── not used, internal modem (PS2)
  112.       └─┴───────── number of printer ports
  113.  
  114.  40:12   byte    PCjr: infrared keyboard link error count
  115.  40:13   word    Memory size in Kbytes  (see INT 12)
  116.  40:15   byte    Reserved
  117.  40:16   byte    PS2 BIOS control flags
  118.  40:17   byte    Keyboard flag byte 0 (see also KB FLAGS)
  119.  
  120.      │7│6│5│4│3│2│1│0│ keyboard flag byte 0
  121.       │ │ │ │ │ │ │ └─── right shift key depressed
  122.       │ │ │ │ │ │ └──── left shift key depressed
  123.       │ │ │ │ │ └───── CTRL key depressed
  124.       │ │ │ │ └────── ALT key depressed
  125.       │ │ │ └─────── scroll-lock is active
  126.       │ │ └──────── num-lock is active
  127.       │ └───────── caps-lock is active
  128.       └────────── insert is active
  129.  
  130.  40:18   byte    Keyboard flag byte 1 (see also KB FLAGS)
  131.  
  132.      │7│6│5│4│3│2│1│0│ keyboard flag byte
  133.       │ │ │ │ │ │ │ └─── left CTRL key depressed
  134.       │ │ │ │ │ │ └──── left ALT key depressed
  135.       │ │ │ │ │ └───── system key depressed and held
  136.       │ │ │ │ └────── suspend key has been toggled
  137.       │ │ │ └─────── scroll lock key is depressed
  138.       │ │ └──────── num-lock key is depressed
  139.       │ └───────── caps-lock key is depressed
  140.       └────────── insert key is depressed
  141.  
  142.  40:19   byte    Storage for alternate keypad entry
  143.  40:1A   word    Offset from 40:00 to keyboard buffer head
  144.  40:1C   word    Offset from 40:00 to keyboard buffer tail
  145.  40:1E  32bytes  Keyboard buffer (circular queue buffer)
  146.  40:3E   byte    Drive recalibration status
  147.  
  148.      │7│6│5│4│3│2│1│0│ drive recalibration status
  149.       │ │ │ │ │ │ │ └── 1=recalibrate drive 0
  150.       │ │ │ │ │ │ └─── 1=recalibrate drive 1
  151.       │ │ │ │ │ └──── 1=recalibrate drive 2
  152.       │ │ │ │ └───── 1=recalibrate drive 3
  153.       │ └─┴─┴────── unused
  154.       └─────────── 1=working interrupt flag
  155.  
  156.  40:3F   byte    Diskette motor status
  157.  
  158.      │7│6│5│4│3│2│1│0│ diskette motor status
  159.       │ │ │ │ │ │ │ └── 1=drive 0 motor on
  160.       │ │ │ │ │ │ └─── 1=drive 1 motor on
  161.       │ │ │ │ │ └──── 1=drive 2 motor on
  162.       │ │ │ │ └───── 1=drive 3 motor on
  163.       │ └─┴─┴────── unused
  164.       └─────────── 1=write operation
  165.  
  166.  40:40   byte    Motor shutoff counter (decremented by INT 8)
  167.  40:41   byte    Status of last diskette operation (see INT 13,1)
  168.  
  169.      │7│6│5│4│3│2│1│0│ status of last diskette operation
  170.       │ │ │ │ │ │ │ └─── invalid diskette command
  171.       │ │ │ │ │ │ └──── diskette address mark not found
  172.       │ │ │ │ │ └───── sector not found
  173.       │ │ │ │ └────── diskette DMA error
  174.       │ │ │ └─────── CRC check / data error
  175.       │ │ └──────── diskette controller failure
  176.       │ └───────── seek to track failed
  177.       └────────── diskette time-out
  178.  
  179.  40:42  7 bytes  NEC diskette controller status (see FDC)
  180.  40:49   byte    Current video mode  (see VIDEO MODE)
  181.  40:4A   word    Number of screen columns
  182.  40:4C   word    Size of current video regen buffer in bytes
  183.  40:4E   word    Offset of current video page in video regen buffer
  184.  40:50  8 words  Cursor position of pages 1-8, high order byte=row
  185.                  low order byte=column; changing this data isn't
  186.                  reflected immediately on the display
  187.  40:60   byte    Cursor ending (bottom) scan line (don't change directly)
  188.  40:61   byte    Cursor starting (top) scan line (don't change directly)
  189.  40:62   byte    Active display page number
  190.  40:63   word    Base port address for active 6845 CRT controller
  191.                  3B4h = mono, 3D4h = color
  192.  40:65   byte    6845 CRT mode control register value (port 3x8h)
  193.                  EGA/VGA values emulate those of the MDA/CGA
  194.  40:66   byte    CGA current color palette mask setting (port 3d9h)
  195.                  EGA and VGA values emulate the CGA
  196.  40:67   dword   CS:IP for 286 return from protected mode
  197.          dword   Temp storage for SS:SP during shutdown
  198.          dword   Day counter on all products after AT
  199.          dword   PS2 Pointer to reset code with memory preserved
  200.         5 bytes  Cassette tape control (before AT)
  201.  40:6C   dword   Daily timer counter, equal to zero at midnight;
  202.                  incremented by INT 8; read/set by INT 1A
  203.  40:70   byte    Clock rollover flag, set when 40:6C exceeds 24hrs
  204.  40:71   byte    BIOS break flag, bit 7 is set if Ctrl-Break was
  205.                  *ever* hit; set by INT 9
  206.  40:72   word    Soft reset flag via Ctl-Alt-Del or JMP FFFF:0
  207.  
  208.                    1234h  Bypass memory tests & CRT initialization
  209.                    4321h  Preserve memory
  210.                    5678h  System suspend
  211.                    9ABCh  Manufacturer test
  212.                    ABCDh  Convertible POST loop
  213.  
  214.  40:74   byte    Status of last hard disk operation (see INT 13,1)
  215.  40:75   byte    Number of hard disks attached
  216.  40:76   byte    XT fixed disk drive control byte
  217.  40:77   byte    Port offset to current fixed disk adapter
  218.  40:78  4 bytes  Time-Out value for LPT1,LPT2,LPT3(,LPT4 except PS2)
  219.  40:7C  4 bytes  Time-Out value for COM1,COM2,COM3,COM4
  220.  40:80   word    Keyboard buffer start offset (seg=40h,BIOS 10-27-82)
  221.  40:82   word    Keyboard buffer end offset (seg=40h,BIOS 10-27-82)
  222.  40:84   byte    Rows on the screen (less 1, EGA+)
  223.  40:85   word    Point height of character matrix (EGA+)
  224.          byte    PCjr: character to be repeated if the typematic
  225.                  repeat key takes effect
  226.  40:86   byte    PCjr: initial delay before repeat key action begins
  227.  40:87   byte    PCjr: current Fn function key number
  228.          byte    Video mode options (EGA+)
  229.  
  230.      │7│6│5│4│3│2│1│0│ Video mode options (EGA+)
  231.       │ │ │ │ │ │ │ └── 1=alphanumeric cursor emulation enabled
  232.       │ │ │ │ │ │ └─── 1=video subsystem attached to monochrome
  233.       │ │ │ │ │ └──── reserved
  234.       │ │ │ │ └───── 1=video subsystem is inactive
  235.       │ │ │ └────── reserved
  236.       │ └─┴─────── video RAM  00-64K  10-192K  01-128K  11-256K
  237.       └────────── video mode number passed to INT 10h, function 0
  238.  
  239.  40:88   byte    PCjr: third keyboard status byte
  240.                  EGA feature bit switches, emulated on VGA
  241.  
  242.      │7│6│5│4│3│2│1│0│ EGA feature bit switches (EGA+)
  243.       │ │ │ │ │ │ │ └── EGA SW1 config (1=off)
  244.       │ │ │ │ │ │ └─── EGA SW2 config (1=off)
  245.       │ │ │ │ │ └──── EGA SW3 config (1=off)
  246.       │ │ │ │ └───── EGA SW4 config (1=off)
  247.       │ │ │ └────── Input FEAT0 (ISR0 bit 5) after output on FCR0
  248.       │ │ └─────── Input FEAT0 (ISR0 bit 6) after output on FCR0
  249.       │ └──────── Input FEAT1 (ISR0 bit 5) after output on FCR1
  250.       └───────── Input FEAT1 (ISR0 bit 6) after output on FCR1
  251.  
  252.  40:89   byte    Video display data area (MCGA and VGA)
  253.  
  254.      │7│6│5│4│3│2│1│0│ Video display data area (MCGA and VGA)
  255.       │ │ │ │ │ │ │ └── 1=VGA is active
  256.       │ │ │ │ │ │ └─── 1=gray scale is enabled
  257.       │ │ │ │ │ └──── 1=using monochrome monitor
  258.       │ │ │ │ └───── 1=default palette loading is disabled
  259.       │ │ │ └────── see table below
  260.       │ │ └─────── reserved
  261.       │ └────────  1=display switching enabled
  262.       └───────── alphanumeric scan lines (see table below)
  263.  
  264.      bit 7   bit 4
  265.        0       0   350 line mode
  266.        0       1   400 line mode
  267.        1       0   200 line mode
  268.        1       1   reserved
  269.  
  270.  40:8A   byte    Display Combination Code (DCC) table index (EGA+)
  271.  40:8B   byte    Last diskette data rate selected
  272.  
  273.      │7│6│5│4│3│2│1│0│ last diskette data rate selected
  274.       │ │ │ │ └─┴─┴─┴─── reserved
  275.       │ │ └─┴────────── last floppy drive step rate selected
  276.       └─┴──────────── last floppy data rate selected
  277.  
  278.        Data Rate                Step Rate
  279.      00 - 500K bps       00 - step rate time of 0C
  280.      01 - 300K bps       01 - step rate time of 0D
  281.      10 - 250K bps       10 - step rate time of 0A
  282.      11 - reserved       11 - reserved
  283.  
  284.  40:8C   byte    Hard disk status returned by controller
  285.  40:8D   byte    Hard disk error returned by controller
  286.  40:8E   byte    Hard disk interrupt control flag(bit 7=working int)
  287.  40:8F   byte    Combination hard/floppy disk card when bit 0 set
  288.  40:90  4 bytes  Drive 0,1,2,3 media state
  289.  
  290.      │7│6│5│4│3│2│1│0│ drive media state (4 copies)
  291.       │ │ │ │ │ └─┴─┴─── drive/media state (see below)
  292.       │ │ │ │ └─────── reserved
  293.       │ │ │ └─────── 1=media/drive established
  294.       │ │ └─────── double stepping required
  295.       └─┴─────── data rate:  00=500K bps    01=300K bps
  296.                              10=250K bps    11=reserved
  297.       Bits
  298.       210  Drive Media State
  299.       000  360Kb diskette/360Kb drive not established
  300.       001  360Kb diskette/1.2Mb drive not established
  301.       010  1.2Mb diskette/1.2Mb drive not established
  302.       011  360Kb diskette/360Kb drive established
  303.       100  360Kb diskette/1.2Mb drive established
  304.       101  1.2Mb diskette/1.2Mb drive established
  305.       110  Reserved
  306.       111  None of the above
  307.  
  308.  40:94   byte    Track currently seeked to on drive 0
  309.  40:95   byte    Track currently seeked to on drive 1
  310.  40:96   byte    Keyboard mode/type
  311.  
  312.      │7│6│5│4│3│2│1│0│ Keyboard mode/type
  313.       │ │ │ │ │ │ │ └─── last code was the E1 hidden code
  314.       │ │ │ │ │ │ └──── last code was the E0 hidden code
  315.       │ │ │ │ │ └───── right CTRL key depressed
  316.       │ │ │ │ └────── right ALT key depressed
  317.       │ │ │ └─────── 101/102 enhanced keyboard installed
  318.       │ │ └──────── force num-lock if Rd ID & KBX
  319.       │ └───────── last char was first ID char
  320.       └────────── read ID in process
  321.  
  322.  40:97   byte    Keyboard LED flags
  323.  
  324.      │7│6│5│4│3│2│1│0│ Keyboard LED flags
  325.       │ │ │ │ │ │ │ └─── scroll lock indicator
  326.       │ │ │ │ │ │ └──── num-lock indicator
  327.       │ │ │ │ │ └───── caps-lock indicator
  328.       │ │ │ │ └────── circus system indicator
  329.       │ │ │ └─────── ACK received
  330.       │ │ └──────── re-send received flag
  331.       │ └───────── mode indicator update
  332.       └────────── keyboard transmit error flag
  333.  
  334.  40:98   dword   Pointer to user wait complete flag
  335.  40:9C   dword   User wait Time-Out value in microseconds
  336.  40:A0   byte    RTC wait function flag
  337.  
  338.      │7│6│5│4│3│2│1│0│ INT 15,86 RTC wait function flag
  339.       │ │ │ │ │ │ │ └─── 1= wait pending
  340.       │ └─┴─┴─┴─┴─┴──── not used
  341.       └─────────────── 1=INT 15,86 wait time elapsed
  342.  
  343.  40:A1   byte    LANA DMA channel flags
  344.  40:A2  2 bytes  Status of LANA 0,1
  345.  40:A4   dword   Saved hard disk interrupt vector
  346.  40:A8   dword   BIOS Video Save/Override Pointer Table address
  347.                  (see VIDEO TABLES)
  348.  40:AC  8 bytes  Reserved
  349.  40:B4   byte    Keyboard NMI control flags (convertible)
  350.  40:B5   dword   Keyboard break pending flags (convertible)
  351.  40:B9   byte    Port 60 single byte queue (convertible)
  352.  40:BA   byte    Scan code of last key (convertible)
  353.  40:BB   byte    NMI buffer head pointer (convertible)
  354.  40:BC   byte    NMI buffer tail pointer (convertible)
  355.  40:BD  16bytes  NMI scan code buffer (convertible)
  356.  40:CE   word    Day counter (convertible and after)
  357.  40:F0  16bytes  Intra-Applications Communications Area (IBM Technical
  358.                  Reference incorrectly locates this at 50:F0-50:FF)
  359.  
  360.  
  361. %Address Size       Description   (BIOS/DOS Data Area)
  362.  
  363.  50:00   byte    Print screen status byte
  364.                   00 = PrtSc not active,
  365.                   01 = PrtSc in progress
  366.                   FF = error
  367.  50:01  3 bytes  Used by BASIC
  368.  50:04   byte    DOS single diskette mode flag, 0=A:, 1=B:
  369.  50:05  10bytes  POST work area
  370.  50:0F   byte    BASIC shell flag; set to 2 if current shell
  371.  50:10   word    BASICs default DS value (DEF SEG)
  372.  50:12   dword   Pointer to BASIC INT 1Ch interrupt handler
  373.  50:16   dword   Pointer to BASIC INT 23h interrupt handler
  374.  50:1A   dword   Pointer to BASIC INT 24h disk error handler
  375.  50:20   word    DOS dynamic storage
  376.  50:22  14bytes  DOS diskette initialization table (INT 1Eh)
  377.  50:30   4bytes  MODE command
  378.  70:00           I/O drivers from IO.SYS/IBMBIO.COM
  379.  
  380. ^The following map varies in size and locus
  381.  
  382.  07C0:0          Boot code is loaded here at startup (31k mark)
  383.  A000:0          EGA/VGA RAM for graphics display mode 0Dh & above
  384.  B000:0          MDA RAM, Hercules graphics display RAM
  385.  B800:0          CGA display RAM
  386.  C000:0          EGA/VGA BIOS ROM (thru C7FF)
  387.  C400:0          Video adapter ROM space
  388.  C600:0 256bytes PGA communication area
  389.  C800:0   16K    Hard disk adapter BIOS ROM
  390.  C800:5          XT Hard disk ROM format, AH=Drive, AL=Interleave
  391.  D000:0   32K    Cluster adapter BIOS ROM
  392.  D800:0          PCjr conventionalsoftware cartridge address
  393.  E000:0   64K    Expansion ROM space (hardwired on AT+)
  394.           128K   PS2 System ROM (thru F000)
  395.  F000:0          System monitor ROM
  396.                  PCjr: software cartridge override address
  397.  F400:0          System expansion ROMs
  398.  F600:0          IBM ROM BASIC (AT)
  399.  F800:0          PCjr software cartridge override address
  400.  FC00:0          BIOS ROM
  401.  FF00:0          System ROM
  402.  FFA6:E          ROM graphics character table
  403.  FFFF:0          ROM bootstrap code
  404.  FFFF:5 8 bytes  ROM date (not applicable for all clones)
  405.  FFFF:E  byte    ROM machine id  (see MACHINE ID)
  406.  
  407.  
  408. :boot sector:boot record
  409. ^Boot Sector (since DOS 2.0)
  410.  
  411. %Offset    Size         Description
  412.  
  413.    00     3 bytes   jump to executable code
  414.    03     8 bytes   OEM name and version
  415.    0B     1 word    bytes per sector
  416.    0D     1 byte    sectors per cluster (allocation unit size)
  417.    0E     1 word    number of reserved sectors (starting at 0)
  418.    10     1 byte    number of FAT's on disk
  419.    11     1 word    number of root directory entries (directory size)
  420.    13     1 word    number of total sectors (0 if partition > 32Mb)
  421.    15     1 byte    media descriptor byte  (see MEDIA DESCRIPTOR)
  422.    16     1 word    sectors per FAT
  423.    18     1 word    sectors per track  (DOS 3.0+)
  424.    1A     1 word    number of heads  (DOS 3.0+)
  425.    1C     1 word    number of hidden sectors  (DOS 3.0+)
  426.    20     1 dword   (DOS 4+) number of sectors if offset 13 was 0
  427.    24     1 byte    (DOS 4+) physical drive number
  428.    25     1 byte    (DOS 4+) reserved
  429.    26     1 byte    (DOS 4+) signature byte (29h)
  430.    27     4 bytes   (DOS 4+) volume serial number
  431.    2B    11 bytes   (DOS 4+) volume label
  432.    36     8 bytes   (DOS 4+) reserved
  433.  
  434.  
  435.  - implementation format not guaranteed in all OEM DOS releases
  436.  - BIOS expects a boot sector of 512 bytes
  437.  - DOS 3.2 began reading BIOS Parameter Block (BPB) information from
  438.    the boot sector, previous versions used only the media byte in FAT
  439.  - DOS 4.x added offsets 20-3Dh and offset 20h determines the number
  440.    of sectors if offset 13h is zero
  441.  - hard disks have a master boot record and partition boot records;
  442.    the master boot record and Disk Partition Table (DPT) share the
  443.    same sector
  444.  
  445.  - see   BPB   DPT   MEDIA DESCRIPTOR
  446.  
  447. :code pages
  448. ^Code Page and Country Codes
  449.  
  450. %                    Country    Keyboard   Valid Code
  451. % Country             Code        Code       Pages
  452.  
  453.  Arabic                785                  437
  454.  Australia             061         US       437,850
  455.  Belgium               032         BE       437,850
  456.  Canada (English)      001         US       437,850
  457.  Canada (French)       002         CF       863,850
  458.  Denmark               045         DK       865,850
  459.  Finland               358         SU       437,850
  460.  France                033         FR       437,850
  461.  Germany               049         GR       437,850
  462.  Hebrew                972                  437
  463.  Italy                 039         IT       437,850
  464.  Latin America         003         LA       437,850
  465.  Netherlands           031         NL       437,850
  466.  Norway                047         NO       865,850
  467.  Portugal              351         PO       860,850
  468.  Spain                 034         SP       437,850
  469.  Sweden                046         SV       437,850
  470.  Switzerland (French)  041         SF       437,850
  471.  Switzerland (German)  041         SF       437,850
  472.  United Kingdom        044         UK       437,850
  473.  United States         001         US       437,850
  474.  
  475.  
  476.  - code pages are lookup tables containing the definition
  477.    of one or more character sets
  478.  - contain country specific information
  479.  - implemented starting with DOS 3.3
  480.  
  481. :colors:color table
  482. ^Color Definitions
  483.  
  484. %Definitions found in TURBO C's "conio.h"
  485.  
  486.  0 - BLACK    4 - RED        8 - DARKGRAY    C - LIGHTRED
  487.  1 - BLUE     5 - MAGENTA    9 - LIGHTBLUE   D - LIGHTMAGENTA
  488.  2 - GREEN    6 - BROWN      A - LIGHTGREEN  E - YELLOW
  489.  3 - CYAN     7 - LIGHTGRAY  B - LIGHTCYAN   F - WHITE
  490.  
  491.  
  492.    │7│6│5│4│3│2│1│0│ AL
  493.     │ │ │ │ │ │ │ └─── blue component of foreground color
  494.     │ │ │ │ │ │ └──── green component of foreground color
  495.     │ │ │ │ │ └───── red component of foreground color
  496.     │ │ │ │ └────── INTENSITY component of foreground color
  497.     │ │ │ └─────── blue component of background color
  498.     │ │ └──────── green component of background color
  499.     │ └───────── red component of background color
  500.     └────────── BLINKING of foreground character
  501.  
  502.  - see  ANSI  for ANSI color definitions
  503. :country codes:country info
  504. ^DOS Country Codes   (DOS 2.x)
  505.  
  506. %Offset Size          Description
  507.  
  508.    00   word    Date and time format
  509.                    0 = month day year,  hh:mm:ss  (USA)
  510.                    1 = day month year,  hh:mm:ss  (Europe)
  511.                    2 = year month day,  hh:mm:ss  (Japan)
  512.    02  2bytes   ASCIIZ currency symbol
  513.    04  2bytes   ASCIIZ thousands separator
  514.    06  2bytes   ASCIIZ decimal separator
  515.    08  18bytes  Reserved
  516.  
  517.  
  518. ^DOS Country Codes   (DOS 3.0+)
  519.  
  520. %Offset Size           Description
  521.  
  522.    00   word    Date and time format
  523.                    0 = month day year,  hh:mm:ss  (USA)
  524.                    1 = day month year,  hh:mm:ss  (Europe)
  525.                    2 = year month day,  hh:mm:ss  (Japan)
  526.    02  5bytes   ASCIIZ currency symbol
  527.    07  2bytes   ASCIIZ thousands separator
  528.    09  2bytes   ASCIIZ decimal separator
  529.    0B  2bytes   ASCIIZ date separator
  530.    0D  2bytes   ASCIIZ time separator
  531.    0F   byte    Currency symbol format
  532.                    0 = symbol leads, without space
  533.                    1 = symbol follows, without space
  534.                    2 = symbol leads, one space
  535.                    3 = symbol follows, one space
  536.                    4 = symbol replace decimal separator
  537.    10   byte    Number of digits after decimal
  538.    11   byte    Time format
  539.                    Bit 0 = 0  12 hour clock
  540.                          = 1  24 hour clock
  541.    12   dword   Case map call address
  542.    16  2bytes   ASCIIZ data list separator
  543.    18  10bytes  Reserved
  544.  
  545.  - see also  INT 21,38
  546.  
  547. :disk partition table:partition table
  548. ^Disk Partition Table (Fixed disk boot record)
  549.  
  550. %Offset      Represents:  (see format below)
  551.  
  552.   01BE       Partition 1 data table  (16 bytes)
  553.   01CE       Partition 2 data table  (16 bytes)
  554.   01DE       Partition 3 data table  (16 bytes)
  555.   01EE       Partition 4 data table  (16 bytes)
  556.   01FE       Signature  (hex 55 AA, 2 bytes)
  557.  
  558. %Offset from beginning of partition data shown above:
  559.  
  560. %Offset Size          Description
  561.  
  562.    00   byte   boot indicator
  563.    01   byte   beginning sector head number
  564.    02   byte   beginning sector (2 high bits of cylinder #)
  565.    03   byte   beginning cylinder# (low order bits of cylinder #)
  566.    04   byte   system indicator
  567.    05   byte   ending sector head number
  568.    06   byte   ending sector (2 high bits of cylinder #)
  569.    07   byte   ending cylinder# (low order bits of cylinder #)
  570.    08   dword  number of sectors preceding the partition
  571.    0B   dword  number of sectors in the partition
  572.  
  573.  
  574. %Boot indicator (BYTE)
  575.  
  576.    00  - non-bootable partition
  577.    80  - bootable partition (one partition only)
  578.  
  579.  
  580. %System Indicator (BYTE)
  581.  
  582.    00 - unknown operating system
  583.    01 - DOS with 12 bit FAT, 16 bit sector number
  584.    02 - XENIX
  585.    04 - DOS with 16 bit FAT, 16 bit sector number
  586.    05 - DOS Extended partition (DOS 3.3+)
  587.    06 - DOS 4.0 (Compaq 3.31), 32 bit sector number
  588.    51 - Ontrack extended partition
  589.    64 - Novell
  590.    75 - PCIX
  591.    DB - CP/M
  592.    FF - BBT
  593.  
  594.  
  595. %Signature
  596.  
  597.    Hex 55AA marks the end of valid boot sector.   This is also
  598.    required in each of the partition boot records.
  599.  
  600.  
  601. %Sector/Cylinder
  602.  
  603.    2 bytes are combined to a word similar to INT 13:
  604.  
  605.   │7│6│5│4│3│2│1│0│ 1st byte  (sector)
  606.    │ │ └─┴─┴─┴─┴─┴── Sector offset within cylinder
  607.    └─┴───────────── High order bits of cylinder #
  608.  
  609.   │7│6│5│4│3│2│1│0│ 2nd byte  (cylinder)
  610.    └─┴─┴─┴─┴─┴─┴───── Low order bits of cylinder #
  611.  
  612.  
  613.  - all partitions begin on sector 1 head 0, except the first
  614.    partition which follows the disk's master boot record and begins
  615.    in sector 2
  616.  - some of this information may vary with some variants of DOS 3.2
  617.    and DOS 3.3 that use their own sectoring scheme for large disks
  618.  
  619.  - see  INT 21,32   DPT   DISK PARTITION TABLE
  620.  
  621. :device attributes
  622. ^Device Driver Attribute Values (brief)
  623.  
  624.  │F│E│D│C│B│A-7│6│5│4│3│2│1│0│
  625.   │ │ │ │ │  │  │ │ │ │ │ │ └── 1 = character device is stdin
  626.   │ │ │ │ │  │  │ │ │ │ │ │     1 = block dev supports generic IOCTL
  627.   │ │ │ │ │  │  │ │ │ │ │ └─── 1 = character device is stdout
  628.   │ │ │ │ │  │  │ │ │ │ │      1 = block dev supports generic IOCTL
  629.   │ │ │ │ │  │  │ │ │ │ └──── 1 = current NUL device
  630.   │ │ │ │ │  │  │ │ │ └───── 1 = current clock device
  631.   │ │ │ │ │  │  │ └─┴────── reserved by DOS
  632.   │ │ │ │ │  │  └───────── 1 = supports Get/Set logical device
  633.   │ │ │ │ │  └─────────── reserved (must be zero)
  634.   │ │ │ │ └───────────── 1 = supports removable media
  635.   │ │ │ └────────────── reserved (must be zero)
  636.   │ │ └─────────────── 1 = non-IBM format (block device)
  637.   │ │                  1 = output until busy (char device)
  638.   │ └──────────────── 1 = supports IOCTL strings
  639.   └───────────────── 1 = character device, 0 = block device
  640.  
  641.  - true bit values are described, a false indicates opposite
  642.  - see  INT 21,44  or  IOCTL,n where "n" is an IOCTL function
  643.  
  644.  
  645. ^Device Driver Attribute Bit Values (detailed)
  646.  
  647.   0  standard input device: used by character devices to
  648.      tell DOS a character device driver is the standard
  649.      input device.   For block devices, a 1 indicates generic
  650.      IOCTL supported
  651.  
  652.   1  standard output device: used by character devices to
  653.      tell DOS a character device driver is the standard
  654.      output device.   For block devices, a 1 indicates generic
  655.      IOCTL supported
  656.  
  657.   2  NUL attribute:  used for character devices only.  Tells
  658.      DOS the character device driver is a NUL device.  This bit
  659.      is used by DOS to determine if the NUL device is being used.
  660.      The NUL device cannot be reassigned.
  661.  
  662.   3  clock device:  set to 1 to tell DOS this is the new
  663.      CLOCK$ device.
  664.  
  665.  0B  open/close removable media:  set to 1 tells DOS the device
  666.      driver can handle removable media. (DOS 3.x)
  667.  
  668.  0D  non-IBM format: for block devices, indicates the method
  669.      the driver uses to determine media type.  Set to 1 for
  670.      drivers that use the BPB to determine media type, set to
  671.      zero for drivers that use the media descriptor byte.  For
  672.      character devices (usually printers), set to 1 if the
  673.      driver supports output until busy, set to 0 otherwise.
  674.  
  675.  0E  IOCTL bit:  used with both character and block devices.
  676.      Indicates if the device driver can handle control strings
  677.      through the IOCTL.  Zero if a device driver can't process
  678.      control strings.   If an attempt to send/receive an IOCTL
  679.      control strings, is made without this bit set, an error code
  680.      is returned.  The IOCTL functions allow data to be sent to
  681.      and from the driver without doing normal reads or writes.
  682.      The device driver can use the data for information.  It is
  683.      up to the device to interpret the string, but the information
  684.      must not be treated as a normal I/O request.   Affects
  685.      only IOCTL functions  AL=2 and AL=5.
  686.  
  687.  0F  device type:  used to indicate block or character device.
  688.  
  689. :device command codes
  690. ^Device Command Codes (Device Request Header)
  691.  
  692. %Code       Function
  693.  
  694.   0     INIT
  695.   1     MEDIA CHECK      (block devices,character = NOP)
  696.   2     BUILD BPB        (block devices,character = NOP)
  697.   3     IOCTL
  698.   4     INPUT            (read)
  699.   5     NONDESTRUCTIVE INPUT NO WAIT (character devices)
  700.   6     INPUT STATUS     (character devices)
  701.   7     INPUT FLUSH      (character devices)
  702.   8     OUTPUT           (write)
  703.   9     OUTPUT           (write with verify)
  704.  10     OUTPUT STATUS    (character devices)
  705.  11     OUTPUT FLUSH     (character devices)
  706.  12     IOCTL OUTPUT
  707.  13     DEVICE OPEN      (DOS 3.x)
  708.  14     DEVICE CLOSE     (DOS 3.x)
  709.  15     REMOVABLE MEDIA  (DOS 3.x)
  710.  
  711. :device header
  712. ^Device Driver Header
  713.  
  714.  
  715. %Offset Size           Description
  716.  
  717.    00   dword  pointer to next device header
  718.    04   word   attribute  (see DEVICE ATTRIBUTE)
  719.    06   word   pointer to device strategy routine
  720.    08   word   pointer to device interrupt routine
  721.    0A  8bytes  name/unit field
  722.  
  723.  
  724.  
  725.  - see  INT 21,44  and  DEVICE ATTRIBUTES
  726.  - see also  IOCTL,n where "n" is an IOCTL function
  727.  
  728. :device request headr
  729. ^Device Request Header Format
  730.  
  731.  
  732. %Offset Size            Description
  733.  
  734.    00   byte   length in bytes of the request header
  735.    01   byte   unit code;  The sub-unit the operation is for (block
  736.                devices);  meaningless for character devices
  737.    02   word   command code, (see DEVICE COMMANDS)
  738.    04  8bytes  reserved for DOS
  739.    0C  nbytes  request data  (variable length)
  740.  
  741.  
  742.  - see  INT 21,44   or   DEVICE ATTRIBUTES   or   DEVICE CODES
  743.  - see also  IOCTL,n where "n" is an IOCTL function
  744.  
  745. :device status
  746. ^Device Status Word
  747.  
  748.  The device status word is set to zero on entry and is set by
  749.  the driver interrupt routine on return.
  750.  
  751.  │15│14-10│9│8│7-0│ STATUS word
  752.    │   │   │ │  └──── Error return code (if bit 15=1)
  753.    │   │   │ └────── Done bit, function completed
  754.    │   │   └─────── Busy bit
  755.    │   └────────── Reserved
  756.    └───────────── Error flag bits 0-7 have error code
  757.  
  758. %Error return codes
  759.  
  760.  00  Write protect violation   01  Unknown unit
  761.  02  Device not ready          03  Unknown command
  762.  04  CRC error                 05  Bad drive request structure length
  763.  06  Seek error                07  Unknown media
  764.  08  Sector not found          09  Printer out of paper
  765.  0A  Write fault               0B  Read fault
  766.  0C  General failure           0D  Reserved
  767.  0E  Reserved                  0F  Invalid disk change
  768.  
  769. :directory format
  770. ^DIRECTORY - DOS Directory Structure
  771.  
  772. %Byte          Description
  773.  
  774.   00     Filename status:
  775.          00 = Filename never used
  776.          05 = First character of filename is E5
  777.          E5 = File has been erased
  778.          2E = This is a subdirectory entry
  779.   00-07  Filename, left justified
  780.   08-0A  Filename extension, left justified
  781.   0B     File's attribute:
  782.  
  783.       │7│6│5│4│3│2│1│0│ byte 0B
  784.        │ │ │ │ │ │ │ └─── read only
  785.        │ │ │ │ │ │ └──── hidden
  786.        │ │ │ │ │ └───── system
  787.        │ │ │ │ └────── volume label
  788.        │ │ │ └─────── subdirectory
  789.        │ │ └──────── archive
  790.        └─┴───────── unused
  791.  
  792.   C-15  Reserved by DOS
  793.  16-17  Time the file was created or last updated:
  794.  
  795.  │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 17,16
  796.   │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─ seconds/2
  797.   │ │ │ │ │ └─┴─┴─┴─┴─┴────────── minutes
  798.   └─┴─┴─┴─┴───────────────────── hours
  799.  
  800.  18-19  Date the file was created or last updated:
  801.  
  802.  │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 19,18
  803.   │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─ day 1-31
  804.   │ │ │ │ │ │ │ └─┴─┴─┴────────── month 1-12
  805.   └─┴─┴─┴─┴─┴─┴───────────────── year + 1980
  806.  
  807.  1A-1B  Starting cluster number of the first file cluster
  808.  1C-1F  File size in bytes (low order first)
  809.  
  810. :dbt:disk base table
  811. ^DBT - Disk Base Table  (BIOS INT 13)
  812.  
  813. %Offset Size           Description
  814.  
  815.    00   byte  specify byte 1; step-rate time, head unload time
  816.    01   byte  specify byte 2; head load time, DMA mode
  817.    02   byte  timer ticks to wait before disk motor shutoff
  818.    03   byte  bytes per sector code:
  819.  
  820.               0 - 128 bytes     2 - 512 bytes
  821.               1 - 256 bytes     3 - 1024 bytes
  822.  
  823.    04   byte  sectors per track (last sector number)
  824.    05   byte  inter-block gap length/gap between sectors
  825.    06   byte  data length, if sector length not specified
  826.    07   byte  gap length between sectors for format
  827.    08   byte  fill byte for formatted sectors
  828.    09   byte  head settle time in milliseconds
  829.    0A   byte  motor startup time in eighths of a second
  830.  
  831. :dta:disk transfer area
  832. ^DTA - Disk Transfer Area  (partially undocumented)
  833.  
  834.  DTA contains data, of which the first 21 bytes (00-15h) are known
  835.  as being "reserved for DOS use on subsequent find next calls"
  836.  
  837. %Offset Size        Description
  838.  
  839.    00   byte    attribute of search (undocumented)
  840.    01   byte    drive used in search  (undocumented)
  841.    02  11bytes  search name used (undocumented)
  842.    0D   word    directory entry number (0 based, DOS 3.x+, undoc.)
  843.    0F   word    starting cluster number of current directory
  844.                 zero for root directory  (DOS 3.x+, undocumented)
  845.    11   word    reserved (undocumented)
  846.    13   word    starting cluster number of current directory
  847.                 zero for root directory  (DOS 2.x+, undocumented)
  848.    15   byte    attribute of matching file
  849.    16   word    file time  (see FILE ATTRIBUTES)
  850.    18   word    file date  (see FILE ATTRIBUTES)
  851.    1A   word    file size
  852.    1E 13bytes   ASCIIZ filename and extension in the form NAME.EXT
  853.                 with blanks stripped
  854.  
  855.  
  856.  - fields of DTA change dependent upon function call in progress
  857.  - the DTA cannot span a 64K segment boundary
  858.  - for compatibility with CP/M the default DTA is at offset 80h
  859.    in the PSP;  this area is also used for the command tail. To
  860.    avoid collision, set another DTA (INT 21,1A) or preserve the
  861.    command tail before using FCB function calls
  862.  
  863.  - see  INT 21,4E   INT 21,1A   INT 21,2F   and   PSP
  864.  
  865. :dos error codes:extended errors
  866. ^DOS Error Codes
  867.  
  868.  Of the following error codes, only error codes 1-12 are
  869.  returned in AX upon exit from interrupt 21 or 24;  The rest
  870.  are obtained by issuing the "get extended error" function
  871.  call;  see INT 21,59
  872.  
  873.  01  Invalid function number
  874.  02  File not found
  875.  03  Path not found
  876.  04  Too many open files (no handles left)
  877.  05  Access denied
  878.  06  Invalid handle
  879.  07  Memory control blocks destroyed
  880.  08  Insufficient memory
  881.  09  Invalid memory block address
  882.  0A  Invalid environment
  883.  0B  Invalid format
  884.  0C  Invalid access mode (open mode is invalid)
  885.  0D  Invalid data
  886.  0E  Reserved
  887.  0F  Invalid drive specified
  888.  10  Attempt to remove current directory
  889.  11  Not same device
  890.  12  No more files
  891.  13  Attempt to write on a write-protected diskette
  892.  14  Unknown unit
  893.  15  Drive not ready
  894.  16  Unknown command
  895.  17  CRC error
  896.  18  Bad request structure length
  897.  19  Seek error
  898.  1A  Unknown media type
  899.  1B  Sector not found
  900.  1C  Printer out of paper
  901.  1D  Write fault
  902.  1E  Read fault
  903.  1F  General failure
  904.  20  Sharing violation
  905.  21  Lock violation
  906.  22  Invalid disk change
  907.  23  FCB unavailable
  908.  24  Sharing buffer overflow
  909.  25  Reserved
  910.  26  Unable to complete file operation (DOS 4.x)
  911.  27-31 Reserved
  912.  32  Network request not supported
  913.  33  Remote computer not listening
  914.  34  Duplicate name on network
  915.  35  Network name not found
  916.  36  Network busy
  917.  37  Network device no longer exists
  918.  38  NetBIOS command limit exceeded
  919.  39  Network adapter error
  920.  3A  Incorrect network response
  921.  3B  Unexpected network error
  922.  3C  Incompatible remote adapter
  923.  3D  Print queue full
  924.  3E  No space for print file
  925.  3F  Print file deleted
  926.  40  Network name deleted
  927.  41  Access denied
  928.  42  Network device type incorrect
  929.  43  Network name not found
  930.  44  Network name limit exceeded
  931.  45  NetBIOS session limit exceeded
  932.  46  Temporarily paused
  933.  47  Network request not accepted
  934.  48  Print or disk redirection is paused
  935.  49-4F Reserved
  936.  50  File already exists
  937.  51  Reserved
  938.  52  Cannot make directory entry
  939.  53  Fail on INT 24
  940.  54  Too many redirections
  941.  55  Duplicate redirection
  942.  56  Invalid password
  943.  57  Invalid parameter
  944.  58  Network device fault
  945.  59  Function not supported by network (DOS 4.x)
  946.  5A  Required system component not installed (DOS 4.x)
  947.  
  948.  
  949. ^DOS Error Code/Classes
  950.  
  951. %Error Classes
  952.  
  953.  01  Out of resource, out of space, channel, etc
  954.  02  Temporary situation, not an error, ex: file lock
  955.  03  Authorization, permission denied
  956.  04  Internal, system detected internal error
  957.  05  Hardware failure, serious problem related to hardware
  958.  06  System failure, ex: invalid configuration
  959.  07  Application error, inconsistent request
  960.  08  Not found, file/item not found
  961.  09  Bad format, file/item in invalid format
  962.  0A  Locked, file/item interlocked
  963.  0B  Media failure, ECC/CRC error, wrong or bad disk
  964.  0C  Already exists, collision with existing item
  965.  0D  Unknown, classification doesn't exist or is inappropriate
  966.  
  967.  
  968. ^DOS Error Code/Action Codes and Locus
  969.  
  970. %Error Action Codes  (in BL)
  971.  
  972.  01  retry, attempt a few more times and re-prompt
  973.  02  delay retry, retry a few more times after a pause
  974.  03  re-enter input, prompt user to re-enter input
  975.  04  abort with cleanup, orderly abort and shutdown
  976.  05  immediate abort, exit immediately without cleanup
  977.  06  ignore error
  978.  07  user intervention, retry after user fixes the problem
  979.  
  980. %Error Locus (in CH)
  981.  
  982.  01  unknown
  983.  02  block device
  984.  03  network
  985.  04  serial device
  986.  05  memory
  987.  
  988. :dos versions:version
  989. ^VERSION - Versions of DOS
  990.  
  991. % Version       Date           Changes
  992.  
  993.  PC-DOS 1.0   Oct 1981  original release, single sided drive
  994.  PC-DOS 1.1   Jun 1982  bugfix, double sided drive support
  995.  MS-DOS 1.25  Jun 1982  for early compatibles
  996.  PC-DOS 2.0   Mar 1983  PC/XT, added (hard drive &UNIX features)
  997.  PC-DOS 2.1   Oct 1983  PCjr & portable mods, fixes for 2.0
  998.  MS-DOS 2.11  Oct 1983  compatible equivalent to 2.1
  999.  PC-DOS 3.0   Aug 1984  support for 1.2 Mb drive (AT)
  1000.  PC-DOS 3.1   Nov 1984  added network support, fixes for 3.0
  1001.  MS-DOS 2.25  Oct 1985  compatible; foreign language support
  1002.  PC-DOS 3.2   Jul 1986  720k 3½" drive support for Convertible
  1003.  PC-DOS 3.3   Apr 1987  PS2, 1.44 disk support, mult. partitions
  1004.  CPQ-DOS 3.31 Oct 1988  Compaq DOS for disk partitions > 32MB
  1005.  PC-DOS 4.0   Aug 1988  Larger DOS partitions, EMS support (bugs)
  1006.  PC-DOS 4.01  ??? ????  Fixes for major bugs in 4.0
  1007.  
  1008.  
  1009.  - IBM was supposedly responsible for most changes in DOS 4.x
  1010.  - DOS 4.01 reports version 4.0, except in some vendor versions
  1011.  - DOS 5.0 is primarily a Microsoft developed version
  1012.  
  1013. :drive parameter tbl:disk parameter table:dpb:dpt
  1014. ^DPT/DPB - Drive Parameter Table / Disk Parameter Block
  1015.  
  1016. %Offset Size            Description
  1017.  
  1018.    00   byte   drive (0 = A, 1 = B)
  1019.    01   byte   unit within drive, usually equals drive (ramdisk=0)
  1020.    02   word   bytes per sector
  1021.    04   byte   sectors per cluster minus 1
  1022.    05   byte   sectors per cluster (times to shift left or x2)
  1023.    06   word   number of sectors before FAT (boot sectors)
  1024.    08   byte   number of FAT copies
  1025.    09   word   number of root directory entries
  1026.    0B   word   number of first data sector
  1027.    0D   word   total number of clusters plus 1
  1028.    0F   byte   number of sectors used by first FAT
  1029.    10   word   number of first sector in directory
  1030.  
  1031.    (data differs for DOS 4.x, see below)
  1032.  
  1033.    12   dword  far pointer to current disk device header
  1034.    16   byte   media descriptor byte (see MEDIA DESCRIPTOR)
  1035.    17   byte   zero if disk has been accessed, default is FF
  1036.    18   dword  far pointer to next drive parameter table; offset
  1037.                is set to FFFFh if last block in chain
  1038.    1C   word   current directory cluster number; 1=root  (DOS 2.x)
  1039.                starting cluster for free space search (DOS 3.x)
  1040.    1E  64bytes ASCIIZ current working directory  (DOS 2.x)
  1041.                number of free clusters; FFFFh = unknown (DOS 3.x)
  1042.  
  1043. %Offsets 13 thru 1F for DOS 4.x
  1044.  
  1045.    13   dword  far pointer to current disk device header
  1046.    17   byte   media descriptor byte (see MEDIA DESCRIPTOR)
  1047.    18   byte   zero if disk has been accessed, default is FF
  1048.    19   dword  pointer to next drive parameter table; offset
  1049.                is set to FFFFh if last block in chain
  1050.    1D   word   starting cluster for free space search
  1051.    1F   word   number of free clusters, FFFFh = unknown
  1052.  
  1053.  
  1054.  - INT 21,32 which is used to read this data resets accessed byte at
  1055.    offset 17h or 18h
  1056.  - sector references are DOS logical sectors
  1057.  - see   DISK BASE TABLE   BPB   INT 21,32
  1058.  
  1059. :drive status data:disk status data:diskette status data
  1060. ^Drive Status Bytes Found in BIOS Data Area
  1061.  
  1062. %Drive recalibration status (at 40:3E)
  1063.  
  1064.  │7│6│5│4│3│2│1│0│ byte at 40:3E
  1065.   │ │ │ │ │ │ │ └─── 1=recalibrate drive 0
  1066.   │ │ │ │ │ │ └──── 1=recalibrate drive 1
  1067.   │ │ │ │ │ └───── 1=recalibrate drive 2
  1068.   │ │ │ │ └────── 1=recalibrate drive 3
  1069.   │ └─┴─┴─────── unused
  1070.   └──────────── 1=working interrupt flag
  1071.  
  1072. %Diskette motor status
  1073.  
  1074.  │7│6│5│4│3│2│1│0│ byte at 40:3F
  1075.   │ │ │ │ │ │ │ └─── 1=drive 0 motor on
  1076.   │ │ │ │ │ │ └──── 1=drive 1 motor on
  1077.   │ │ │ │ │ └───── 1=drive 2 motor on
  1078.   │ │ │ │ └────── 1=drive 3 motor on
  1079.   │ └─┴─┴─────── unused
  1080.   └──────────── 1=write operation
  1081.  
  1082. %Disk Status Byte
  1083.  
  1084.  │7│6│5│4│3│2│1│0│ byte at 40:41
  1085.   │ │ │ │ │ │ │ └─── invalid diskette command
  1086.   │ │ │ │ │ │ └──── diskette address mark not found
  1087.   │ │ │ │ │ └───── sector not found
  1088.   │ │ │ │ └────── diskette DMA error
  1089.   │ │ │ └─────── CRC check / data error
  1090.   │ │ └──────── diskette controller failure
  1091.   │ └───────── seek to track failed
  1092.   └────────── diskette time-out
  1093.  
  1094. %Last diskette data rate selected
  1095.  
  1096.  │7│6│5│4│3│2│1│0│ byte at 40:8B
  1097.   │ │ │ │ └─┴─┴─┴─── step rate time selected (see below)
  1098.   └─┴─┴─┴────────── data rate selected (see below)
  1099.  
  1100. %Bits
  1101. % 76  Diskette Data Rate Selected
  1102.   00  500K bps
  1103.   01  300K bps
  1104.   10  250K bps
  1105.   11  reserved
  1106.  
  1107. %Bits
  1108. % 54  Diskette Step Rate Time Selected
  1109.   00  step rate time of 0C
  1110.   01  step rate time of 0D
  1111.   10  step rate time of 0A
  1112.   11  reserved
  1113.  
  1114. %Media state for fixed drives (bytes at 40:90-93)
  1115.  
  1116.  │7│6│5│4│3│2│1│0│ bytes at 40:90-40:93
  1117.   │ │ │ │ │ └─┴─┴─── reserved (set to 1)
  1118.   │ │ │ │ └──────── reserved
  1119.   │ │ │ └───────── 0=media/drive unestablished
  1120.   │ │ └────────── reserved
  1121.   └─┴─────────── data rate (see below)
  1122.  
  1123. %Bits
  1124. % 76  Fixed Disk Data Rate Selected
  1125.   00  500K bps
  1126.   01  reserved
  1127.   10  250K bps
  1128.   11  reserved
  1129.  
  1130.  - not all OEM's implemented these bytes identically.  Some are
  1131.    also AT specific.
  1132.  
  1133. :exe file header:.exe
  1134. ^.EXE - DOS EXE File Structure
  1135.  
  1136. %Offset Size          Description
  1137.  
  1138.    00   word  "MZ" - Link file .EXE signature (Mark Zbikowski?)
  1139.    02   word  length of image mod 512
  1140.    04   word  size of file in 512 byte pages
  1141.    06   word  number of relocation items following header
  1142.    08   word  size of header in 16 byte paragraphs, used to locate
  1143.               the beginning of the load module
  1144.    0A   word  min # of paragraphs needed to run program
  1145.    0C   word  max # of paragraphs the program would like
  1146.    0E   word  offset in load module of stack segment (in paras)
  1147.    10   word  initial SP value to be loaded
  1148.    12   word  negative checksum of pgm used while by EXEC loads pgm
  1149.    14   word  program entry point, (initial IP value)
  1150.    16   word  offset in load module of the code segment (in paras)
  1151.    18   word  offset in .EXE file of first relocation item
  1152.    1A   word  overlay number (0 for root program)
  1153.  
  1154.  - relocation table and the program load module follow the header
  1155.  - relocation entries are 32 bit values representing the offset
  1156.    into the load module needing patched
  1157.  - once the relocatable item is found, the CS register is added to
  1158.    the value found at the calculated offset
  1159.  
  1160. %Registers at load time of the EXE file are as follows:
  1161.  
  1162.     AX:    contains number of characters in command tail, or 0
  1163.     BX:CX  32 bit value indicating the load module memory size
  1164.     DX     zero
  1165.     SS:SP  set to stack segment if defined else,  SS = CS and
  1166.            SP=FFFFh or top of memory.
  1167.     DS     set to segment address of EXE header
  1168.     ES     set to segment address of EXE header
  1169.     CS:IP  far address of program entry point, (label on "END"
  1170.            statement of program)
  1171.  
  1172. :ebda:extended bios
  1173. ^EBDA - Extended BIOS Data Area EBDA (PS2)
  1174.  
  1175. %Offset   Size            Description
  1176.  
  1177.   00      word      number of bytes allocated to EBDA in Kbytes
  1178.   01-21   21bytes   reserved
  1179.   22      dword     device driver far call pointer
  1180.   26      byte      pointing device flag (1st byte, see below)
  1181.   27      byte      pointing device flag (2nd byte, see below)
  1182.   28-2F   8 bytes   reserved
  1183.  
  1184.  
  1185. %Pointing Device Flag Byte 1
  1186.  
  1187.  │7│6│5│4│3│2│1│0│ Offset 26
  1188.   │ │ │ │ │ └─┴─┴─── index count
  1189.   │ │ │ │ └──────── reserved (0)
  1190.   │ │ │ └───────── error
  1191.   │ │ └────────── acknowledge
  1192.   │ └─────────── resend
  1193.   └──────────── command in progress
  1194.  
  1195. %Pointing Device Flag Byte 2
  1196.  
  1197.   │7│6│5│4│3│2│1│0│ Offset 27
  1198.    │ │ │ │ │ └─┴─┴─── package size
  1199.    │ └─┴─┴─┴──────── reserved
  1200.    └─────────────── device driver far call flag
  1201.  
  1202.  
  1203.  - EBDA is located in highest memory just under 640K on PS2
  1204.  - word at 40:0E is segment address of EBDA
  1205.  
  1206. :fat:file allocation table
  1207. ^FAT - File Allocation Table
  1208.  
  1209. %12 Bit                   Meaning                      16 Bit
  1210.  
  1211.   000                    free space                   0000
  1212.   FF1-FF7             bad track marking               FFF1-FFF7
  1213.   FF8-FFE   may be used to mark end of a file chain   FFF8-FFFE
  1214.   FFF       standard marker for end of a file chain   FFFF
  1215.  
  1216.  
  1217.  - the FAT is implemented as an array containing a linked list
  1218.    for each file;  the files directory entry has a pointer to the
  1219.    first cluster which contains the cluster number of the next
  1220.    cluster in the chain until the pointer contained is FFFh
  1221.    (12 bit FAT) and FFFFh (16 bit FAT) marking end of file
  1222.  - DOS maintains two copies of the FAT, but does not use the
  1223.    second copy for anything other than a mirror image of the
  1224.    first;  CHKDSK doesn't even read the second FAT
  1225.  - disks with FF1h clusters and above use 16 bit FAT tables, disk
  1226.    with less use 12 bit FAT tables
  1227.  - DOS 4.x did not change the size of the cluster number as some
  1228.    suggest, but instead increased the size of the sector number
  1229.  - bytes 0 of the FAT contains the Media Descriptor Byte
  1230.  
  1231.  
  1232. ^Calculating 12 bit FAT Entries
  1233.  
  1234.  1. Get starting cluster from directory entry.
  1235.  
  1236.  2. Multiply the cluster number just used by 1.5
  1237.  
  1238.  3. The whole part of the product is the offset into the FAT,
  1239.     of the entry that maps to the cluster in the directory.
  1240.     This entry contains the number of the next cluster.
  1241.  
  1242.  4. Move the word at the calculated FAT into a register.
  1243.  
  1244.  5. If the last cluster used was an even number, keep the low order
  1245.     12 bits of the register, otherwise, keep the high order 12 bits.
  1246.  
  1247.  6. If the resultant 12 bits are (0FF8h-0FFFh) no more clusters
  1248.     are in the file.   Otherwise, the next 12 bits contain the
  1249.     cluster number of the next cluster in the file.
  1250.  
  1251.  
  1252. ^Calculating 16 Bit FAT Entries
  1253.  
  1254.  1. Get the starting cluster of the file from the directory.
  1255.  
  1256.  2. Multiply the cluster number found by 2.
  1257.  
  1258.  3. Load the word at the calculated FAT offset into a register.
  1259.  
  1260.  4. If the 16 bits are (0FFF8h-0FFFFh) no more clusters are in
  1261.     the file. Otherwise, the 16 bits contain the cluster number
  1262.     of the next cluster in the file.
  1263.  
  1264.  
  1265.  To convert the cluster to a logical sector number (relative
  1266.  sector, similar to that used by DEBUG, int 25h and 26h):
  1267.  
  1268.  1. Subtract 2 from the cluster number
  1269.  2. Multiply the result by the number of sectors per cluster.
  1270.  3. Add the logical sector number of the beginning of the data area.
  1271.  
  1272.  
  1273.  - see  MEDIA DESCRIPTOR
  1274.  
  1275. :fcb:file control block
  1276. ^FCB - Standard DOS File Control Block
  1277.  
  1278. %Offset Size            Description
  1279.  
  1280.    00   byte   drive number (0 for default drive, 1 = A:, 2 = B:)
  1281.    01  8bytes  filename, left justified with trailing blanks
  1282.    09  3bytes  filename extension, left justified w/blanks
  1283.    12   word   current block number relative to beginning of the
  1284.                file, starting with zero
  1285.    14   word   logical record size in bytes
  1286.    16   dword  file size in bytes
  1287.    20   word   date the file was created or last updated
  1288.  
  1289.  │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 21,20 (Intel reverse order)
  1290.   │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─ day 1-31
  1291.   │ │ │ │ │ │ │ └─┴─┴─┴────────── month 1-12
  1292.   └─┴─┴─┴─┴─┴─┴───────────────── year + 1980
  1293.  
  1294.    22 10bytes  reserved for system use
  1295.    32   byte   current relative record number within current BLOCK
  1296.    33  dword   relative record number relative to the beginning of
  1297.                the file, starting with zero
  1298.  
  1299. %The following are FCB related DOS functions:
  1300.  
  1301.  INT 21,F  - Open file using FCB
  1302.  INT 21,10 - Close file using FCB
  1303.  INT 21,11 - Search for first entry using FCB
  1304.  INT 21,12 - Search for next entry using FCB
  1305.  INT 21,13 - Delete file using FCB
  1306.  INT 21,14 - Sequential read using FCB
  1307.  INT 21,15 - Sequential write using FCB
  1308.  INT 21,16 - Create a file using FCB
  1309.  INT 21,17 - Rename file using FCB
  1310.  INT 21,21 - Random read using FCB
  1311.  INT 21,22 - Random write using FCB
  1312.  INT 21,23 - Get file size using FCB
  1313.  INT 21,24 - Set relative record field for FCB
  1314.  INT 21,27 - Random block read using FCB
  1315.  INT 21,28 - Random block write using FCB
  1316.  INT 21,29 - Parse filename for FCB
  1317.  
  1318.  
  1319.  - see also  XFCB  and the above DOS INT 21 functions
  1320.  
  1321. :file attributes
  1322. ^DOS File Attributes
  1323.  
  1324. %Directory Attribute Flags
  1325.  
  1326.  │7│6│5│4│3│2│1│0│ Directory Attribute Flags
  1327.   │ │ │ │ │ │ │ └─── 1 = read only
  1328.   │ │ │ │ │ │ └──── 1 = hidden
  1329.   │ │ │ │ │ └───── 1 = system
  1330.   │ │ │ │ └────── 1 = volume label  (exclusive)
  1331.   │ │ │ └─────── 1 = subdirectory
  1332.   │ │ └──────── 1 = archive
  1333.   └─┴───────── unused
  1334.  
  1335. %Directory Time Format
  1336.  
  1337.  │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ Directory Time Format
  1338.   │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─── seconds (2 second increments)
  1339.   │ │ │ │ │ └─┴─┴─┴─┴─┴──────────── minutes (0-59)
  1340.   └─┴─┴─┴─┴─────────────────────── hours (0-23)
  1341.  
  1342. %Directory Date Format
  1343.  
  1344.  │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ Directory Date Format
  1345.   │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─── Day (1-31)
  1346.   │ │ │ │ │ │ │ └─┴─┴─┴──────────── Month (1-12)
  1347.   └─┴─┴─┴─┴─┴─┴─────────────────── Year (less 1980)
  1348.  
  1349.  
  1350.  - with respect to the findfirst() and findnext() functions normal
  1351.    files are always included along with the requested attributes
  1352.    except when the LABEL attribute is requested.  It's up to the
  1353.    programmer to determine which files are match the requested
  1354.    attributes.
  1355. :float formats:floating point:real numbers
  1356. ^Floating Point Formats
  1357.  
  1358. %IEEE 4 byte real
  1359.  
  1360.   31 30    23 22                        0
  1361.   ┌─┬────────┬──────────────────────────┐
  1362.   │s│ 8 bits │msb   23 bit mantissa  lsb│
  1363.   └─┴────────┴──────────────────────────┘
  1364.    │     │                └────────────────  mantissa
  1365.    │     └────────────────────────────────  biased exponent (7fh)
  1366.    └─────────────────────────────────────  sign bit
  1367.  
  1368. %IEEE 8 byte real
  1369.  
  1370.   63 62      52 51                                  0
  1371.   ┌─┬──────────┬────────────────────────────────────┐
  1372.   │s│  11 bits │msb       52 bit mantissa        lsb│
  1373.   └─┴──────────┴────────────────────────────────────┘
  1374.    │     │                └────────────────  mantissa
  1375.    │     └────────────────────────────────  biased exponent (3FFh)
  1376.    └─────────────────────────────────────  sign bit
  1377.  
  1378. %Microsoft 4 byte real
  1379.  
  1380.   31     24 23 22                       0
  1381.   ┌────────┬─┬──────────────────────────┐
  1382.   │ 8 bits │s│msb  23 bit mantissa   lsb│
  1383.   └────────┴─┴──────────────────────────┘
  1384.       │     │             └────────────────  mantissa
  1385.       │     └─────────────────────────────  sign bit
  1386.       └──────────────────────────────────  biased exponent (81h)
  1387.  
  1388. %Microsoft 8 byte real (see note below)
  1389.  
  1390.   63      53 52 51                                 0
  1391.   ┌─────────┬─┬────────────────────────────────────┐
  1392.   │ 11 bits │s│msb       52 bit mantissa        lsb│
  1393.   └─────────┴─┴────────────────────────────────────┘
  1394.        │     │                 └────────────  mantissa
  1395.        │     └─────────────────────────────  sign bit
  1396.        └──────────────────────────────────  biased exponent (401h)
  1397.  
  1398. %IEEE 10 byte real (temporary real)
  1399.  
  1400.   79 78       64 63 62                                     0
  1401.   ┌─┬───────────┬─┬────────────────────────────────────────┐
  1402.   │s│  15 bits  │1│msb         63 bit mantissa          lsb│
  1403.   └─┴───────────┴─┴────────────────────────────────────────┘
  1404.    │     │       │                   └─────  mantissa
  1405.    │     │       └────────────────────────  first mantissa bit
  1406.    │     └───────────────────────────────  biased exponent (3FFFh)
  1407.    └────────────────────────────────────  sign bit
  1408.  
  1409. %Turbo Pascal 6 byte real
  1410.  
  1411.   47     40 39 38                                 0
  1412.   ┌────────┬─┬────────────────────────────────────┐
  1413.   │ 8 bits │s│msb       39 bit mantissa        lsb│
  1414.   └────────┴─┴────────────────────────────────────┘
  1415.       │     │                 └────────────  mantissa
  1416.       │     └─────────────────────────────  sign bit
  1417.       └──────────────────────────────────  biased exponent (80h)
  1418.  
  1419. %Microsoft Fortran Complex number
  1420.  ┌──────────────────────────┬─────────────────────────────┐
  1421.  │   Float Real component   │  Float Imaginary component  │
  1422.  └──────────────────────────┴─────────────────────────────┘
  1423.      (each component is either 8 or 16 byte IEEE real)
  1424.  
  1425.  
  1426.  - sign bit representation:  0 is positive  and  1 is negative
  1427.  - in all float formats except the IEEE 10 byte real, the
  1428.    mantissa is stored without most significant bit; since
  1429.    the state of this bit is known to be set, it is not
  1430.    included and the exponent is adjusted accordingly
  1431.  - all formats use binary float representation
  1432.  - memory representation uses 80x86 reverse byte/word order.
  1433.  - Microsoft languages use the IEEE real formats;  BASIC is the
  1434.    only normal user of the Microsoft float format
  1435.  - Microsoft 8 byte real format has not been verified;  several
  1436.    Microsoft publications show an 8 bit exponent instead of 11 bits
  1437.    and state the BIAS is 401h;  8 bits can't hold 401h, but 11 can
  1438.  
  1439.  
  1440. %True exponent is the exponent value minus the following bias:
  1441.  
  1442.        81h for Microsoft 4 byte real
  1443.       401h for Microsoft 8 byte real
  1444.        7Fh for IEEE 4 byte real
  1445.       3FFh for IEEE 8 byte real
  1446.        80h for Turbo Pascal 6 byte real
  1447.  
  1448. %     Size                  Range             Significant digits
  1449.  
  1450.    4 byte real     8.43x10E-37 to 3.37x10E38         6-7
  1451.    8 byte real    4.19x10E-307 to 1.67x10E308       15-16
  1452.   10 byte real    3.4x10E-4932 to 1.2x10E4932         19
  1453.  
  1454.  
  1455.  - see   dmsbintoieee   dieeetomsbin   NUMERIC RANGES
  1456.  
  1457. :floppy formats:disk formats
  1458. ^Common Floppy Disk Formats
  1459.  
  1460. %                      ┌──────Sectors──────┐  Entries
  1461. %   Disk        Sides  per    per  per   per    per   Total
  1462. %   Type    DOS   #    TRK    FAT  DIR Cluster  DIR  Sectors
  1463.  ───────────────────────────────────────────────────────────
  1464.  
  1465.   5¼ 160k  (1.0)  1   8 (40)   1    4     1      64    320
  1466.  
  1467.   5¼ 320k  (1.1)  2   8 (40)   1    7     2     112    640
  1468.  
  1469.   5¼ 180k  (2.0)  1   9 (40)   2    4     1      64    360
  1470.  
  1471.   5¼ 360k  (2.0)  2   9 (40)   2    7     2     112    720
  1472.  
  1473.   5¼ 1.2M  (3.0)  2  15 (80)   7   14     1     224   2400
  1474.  
  1475.   3½ 720k  (3.2)  2   9 (80)   3    7     2     112   1440
  1476.  
  1477.   3½ 1.44M (3.3)  2  18 (80)   9   14     1     224   2880
  1478.  
  1479. :id bytes:machine identificatn
  1480. ^Machine Identification Byte
  1481.  
  1482. % Model  Sub-Model         Machine
  1483.  
  1484.    FF       ??     Original IBM PC  4/24/81
  1485.             ??     IBM PC  10/19/81
  1486.             ??     IBM PC  10/27/82
  1487.    FE       ??     IBM XT (Original)
  1488.             ??     IBM portable PC
  1489.             ??     Compaq DeskPro
  1490.    FD       ??     PCjr
  1491.    FC       ??     IBM AT (6 MHz)
  1492.             01     IBM AT 3x9 (8 MHz)
  1493.             02     IBM XT 286
  1494.             04     IBM PS/2 Model 50
  1495.             05     IBM PS/2 Model 60
  1496.             0B     IBM PS/1
  1497.    FB       00     IBM 256/640K XT (aka XT/2)
  1498.    FA       00     IBM PS/2 Model 30
  1499.             01     IBM PS/2 Model 25
  1500.    F9       00     IBM PC Convertible
  1501.    F8       00     IBM PS/2 Model 80  (16 MHz)
  1502.             01     IBM PS/2 Model 80  (20 MHz)
  1503.             04     IBM PS/2 Model 70  (20 MHz)
  1504.             09     IBM PS/2 Model 70  (16 MHz)
  1505.    B6       ??     Hewlett Packard 110
  1506.    9A       ??     Compaq Plus
  1507.    86              XT (BIOS 11/82+) & AT (BIOS 1/84+) (see note)
  1508.    80              PC & PCjr (see note)
  1509.    2D       ??     Compaq PC
  1510.  
  1511.  
  1512.  - found at memory location F000:FFFE or via INT 15,C0
  1513.  - model values of 80 & 86 are returned by BIOS versions previous
  1514.    to the PS/2 but after the BIOS dates marked
  1515.  
  1516.  - see   INT 15,C0
  1517.  
  1518. :kb flags:keyboard flags
  1519. ^Keyboard Flags Bytes 0 and 1
  1520.  
  1521.   │7│6│5│4│3│2│1│0│  40:17  Keyboard Flags Byte 0
  1522.    │ │ │ │ │ │ │ └──── right shift key depressed
  1523.    │ │ │ │ │ │ └───── left shift key depressed
  1524.    │ │ │ │ │ └────── CTRL key depressed
  1525.    │ │ │ │ └─────── ALT key depressed
  1526.    │ │ │ └──────── scroll-lock is active
  1527.    │ │ └───────── num-lock is active
  1528.    │ └────────── caps-lock is active
  1529.    └─────────── insert is active
  1530.  
  1531.   │7│6│5│4│3│2│1│0│  40:18  Keyboard Flags Byte 1
  1532.    │ │ │ │ │ │ │ └──── left CTRL key depressed
  1533.    │ │ │ │ │ │ └───── left ALT key depressed
  1534.    │ │ │ │ │ └────── system key depressed and held
  1535.    │ │ │ │ └─────── suspend key has been toggled
  1536.    │ │ │ └──────── scroll lock key is depressed
  1537.    │ │ └───────── num-lock key is depressed
  1538.    │ └────────── caps-lock key is depressed
  1539.    └─────────── insert key is depressed
  1540.  
  1541. ^Keyboard Flags Bytes 2 and 3
  1542.  
  1543.   │7│6│5│4│3│2│1│0│  40:97  LED Indicator Flags
  1544.    │ │ │ │ │ │ │ └──── scroll lock indicator
  1545.    │ │ │ │ │ │ └───── num-lock indicator
  1546.    │ │ │ │ │ └────── caps-lock indicator
  1547.    │ │ │ │ └─────── circus system indicator
  1548.    │ │ │ └──────── ACK received
  1549.    │ │ └───────── re-send received flag
  1550.    │ └────────── mode indicator update
  1551.    └─────────── keyboard transmit error flag
  1552.  
  1553.   │7│6│5│4│3│2│1│0│  40:96  Keyboard Mode/Type
  1554.    │ │ │ │ │ │ │ └──── last code was the E1 hidden code
  1555.    │ │ │ │ │ │ └───── last code was the E0 hidden code
  1556.    │ │ │ │ │ └────── right CTRL key depressed
  1557.    │ │ │ │ └─────── right ALT key depressed
  1558.    │ │ │ └──────── 101/102 enhanced keyboard installed
  1559.    │ │ └───────── force num-lock if Rd ID & KBX
  1560.    │ └────────── last char was first ID char
  1561.    └─────────── read ID in process
  1562.  
  1563.  - see   INT 9   BDA
  1564. :make codes:break codes
  1565. ^INT 9 - Hardware Keyboard Make/Break Codes
  1566.  
  1567. %Key          Make  Break              Key    Make  Break
  1568.  
  1569.  Backspace     0E    8E                F1      3B    BB
  1570.  Caps Lock     3A    BA                F2      3C    BC
  1571.  Enter         1C    9C                F3      3D    BD
  1572.  Esc           01    81                F4      3E    BE
  1573.  Left Alt      38    B8                F7      41    C1
  1574.  Left Ctrl     1D    9D                F5      3F    BF
  1575.  Left Shift    2A    AA                F6      40    C0
  1576.  Num Lock      45    C5                F8      42    C2
  1577.  Right Shift   36    B6                F9      43    C3
  1578.  Scroll Lock   46    C6                F10     44    C4
  1579.  Space         39    B9                F11     57    D7
  1580.  Sys Req (AT)  54    D4                F12     58    D8
  1581.  Tab           0F    8F
  1582.  
  1583. %Keypad Keys              Make  Break
  1584.  
  1585.  Keypad 0  (Ins)           52    D2
  1586.  Keypad 1  (End)           4F    CF
  1587.  Keypad 2  (Down arrow)    50    D0
  1588.  Keypad 3  (PgDn)          51    D1
  1589.  Keypad 4  (Left arrow)    4B    CB
  1590.  Keypad 5                  4C    CC
  1591.  Keypad 6  (Right arrow)   4D    CD
  1592.  Keypad 7  (Home)          47    C7
  1593.  Keypad 8  (Up arrow)      48    C8
  1594.  Keypad 9  (PgUp)          49    C9
  1595.  Keypad .  (Del)           53    D3
  1596.  Keypad *  (PrtSc)         37    B7
  1597.  Keypad -                  4A    CA
  1598.  Keypad +                  4E    CE
  1599.  
  1600. %Key   Make  Break              Key   Make  Break
  1601.  
  1602.  A      1E    9E                N      31    B1
  1603.  B      30    B0                O      18    98
  1604.  C      2E    AE                P      19    99
  1605.  D      20    A0                Q      10    90
  1606.  E      12    92                R      13    93
  1607.  F      21    A1                S      1F    9F
  1608.  G      22    A2                T      14    94
  1609.  H      23    A3                U      16    96
  1610.  I      17    97                V      2F    AF
  1611.  J      24    A4                W      11    91
  1612.  K      25    A5                X      2D    AD
  1613.  L      26    A6                Y      15    95
  1614.  M      32    B2                Z      2C    AC
  1615.  
  1616. %Key   Make  Break              Key   Make  Break
  1617.  
  1618.  1      02    82                -      0C    8C
  1619.  2      03    83                =      0D    8D
  1620.  3      04    84                [      1A    9A
  1621.  4      05    85                ]      1B    9B
  1622.  5      06    86                ;      27    A7
  1623.  6      07    87                '      28    A8
  1624.  7      08    88                `      29    A9
  1625.  8      09    89                \      2B    AB
  1626.  9      0A    8A                ,      33    B3
  1627.  0      0B    8B                .      34    B4
  1628.                                 /      35    B5
  1629.  
  1630. ^Enhanced Keyboard Keys (101/102 keys)
  1631.  
  1632. %Control Keys              Make            Break
  1633.  
  1634.  Alt-PrtSc (SysReq)        54              D4
  1635.  Ctrl-PrtSc                E0 37           E0 B7
  1636.  Enter                     E0 1C           E0 9C
  1637.  PrtSc                     E0 2A E0 37     E0 B7 E0 AA
  1638.  Right Alt                 E0 38           E0 B8
  1639.  Right Ctrl                E0 1D           E0 9D
  1640.  Shift-PrtSc               E0 37           E0 B7
  1641.  /                         E0 35           E0 B5
  1642.  Pause                     E1 1D 45 E1 9D C5  (not typematic)
  1643.  Ctrl-Pause (Ctrl-Break)   E0 46 E0 C6        (not typematic)
  1644.  
  1645.  - Keys marked as "not typematic" generate one stream of bytes
  1646.    without corresponding break scan code bytes (actually the
  1647.    break codes are part of the make code).
  1648.  
  1649.  
  1650. %                Normal Mode or
  1651. %                Shift w/Numlock
  1652. %Key              Make    Break     ┌───── Numlock on ──────┐
  1653. %                                      Make          Break
  1654.  Del              E0 53   E0 D3     E0 2A E0 53   E0 D3 E0 AA
  1655.  Down arrow       E0 50   E0 D0     E0 2A E0 50   E0 D0 E0 AA
  1656.  End              E0 4F   E0 CF     E0 2A E0 4F   E0 CF E0 AA
  1657.  Home             E0 47   E0 C7     E0 2A E0 47   E0 C7 E0 AA
  1658.  Ins              E0 52   E0 D2     E0 2A E0 52   E0 D2 E0 AA
  1659.  Left arrow       E0 4B   E0 CB     E0 2A E0 4B   E0 CB E0 AA
  1660.  PgDn             E0 51   E0 D1     E0 2A E0 51   E0 D1 E0 AA
  1661.  PgUp             E0 49   E0 C9     E0 2A E0 49   E0 C9 E0 AA
  1662.  Right arrow      E0 4D   E0 CD     E0 2A E0 4D   E0 CD E0 AA
  1663.  Up arrow         E0 48   E0 C8     E0 2A E0 48   E0 C8 E0 AA
  1664.  
  1665. %Key           ┌──Left Shift Pressed──┐    ┌──Right Shift Pressed──┐
  1666. %                 Make          Break          Make          Break
  1667.  Del           E0 AA E0 53   E0 D3 E0 2A    E0 B6 E0 53   E0 D3 E0 36
  1668.  Down arrow    E0 AA E0 50   E0 D0 E0 2A    E0 B6 E0 50   E0 D0 E0 36
  1669.  End           E0 AA E0 4F   E0 CF E0 2A    E0 B6 E0 4F   E0 CF E0 36
  1670.  Home          E0 AA E0 47   E0 C7 E0 2A    E0 B6 E0 47   E0 C7 E0 36
  1671.  Ins           E0 AA E0 52   E0 D2 E0 2A    E0 B6 E0 52   E0 D2 E0 36
  1672.  Left arrow    E0 AA E0 4B   E0 CB E0 2A    E0 B6 E0 4B   E0 CB E0 36
  1673.  PgDn          E0 AA E0 51   E0 D1 E0 2A    E0 B6 E0 51   E0 D1 E0 36
  1674.  PgUp          E0 AA E0 49   E0 C9 E0 2A    E0 B6 E0 49   E0 C9 E0 36
  1675.  Right arrow   E0 AA E0 4D   E0 CD E0 2A    E0 B6 E0 4D   E0 CD E0 36
  1676.  Up arrow      E0 AA E0 48   E0 C8 E0 2A    E0 B6 E0 48   E0 C8 E0 36
  1677.  /             E0 AA E0 35   E0 B5 E0 2A    E0 B6 E0 35   E0 B5 E0 36
  1678.  
  1679.  
  1680.  - The PS/2 models have three make/break scan code sets.  The first
  1681.    set matches the PC & XT make/break scan code set and is the one
  1682.    listed here.  Scan code sets are selected by writing the value F0
  1683.    to the keyboard via the 8042 (port 60h).  The following is a brief
  1684.    description of the scan code sets (see the PS/2 Technical Reference
  1685.    manuals for more information on scan code sets 2 and 3):
  1686.  
  1687.    ∙  set 1, each key has a base scan code.  Some keys generate
  1688.       extra scan codes to generate artificial shift states.  This
  1689.       is similar to the standard scan code set used on the PC and XT.
  1690.    ∙  set 2, each key sends one make scan code and two break scan
  1691.       codes bytes (F0 followed by the make code).  This scan code
  1692.       set is available on the IBM AT also.
  1693.    ∙  set 3, each key sends one make scan code and two break scan
  1694.       codes bytes (F0 followed by the make code) and no keys are
  1695.       altered by Shift/Alt/Ctrl keys.
  1696.    ∙  typematic scan codes are the same as the make scan code
  1697.  
  1698.  - Some Tandy 1000's do not handle Alt key combinations when multiple
  1699.    shift keys are pressed.  The Alt-Shift-H combination loses the Alt.
  1700.  - see   SCAN CODES   KB FLAGS   8042   KEYBOARD COMMANDS
  1701. :gdt:global descriptor table
  1702. ^GDT - Global Descriptor Table
  1703.  
  1704. %Offset Size            Description
  1705.  
  1706.    00  8bytes   dummy, set to 0
  1707.    08  8bytes   GDT data segment location, set to 0
  1708.    10  8bytes   source GDT pointer
  1709.    18  8bytes   target GDT pointer
  1710.    20  8bytes   pointer to BIOS code segment, set to 0.  used by
  1711.                 the BIOS to create protected mode code segment
  1712.    28  8bytes   pointer to BIOS stack segment, set to 0.  Used by
  1713.                 the BIOS to create protected mode stack segment
  1714.    30  8bytes   user code segment
  1715.    38  8bytes   temporary BIOS code segment
  1716.  
  1717.  
  1718. %Source/Target GDT use the following format (offsets 10h and 18h):
  1719.  
  1720. %Offset Size             Description
  1721.  
  1722.    00   word    Segment limit
  1723.    02  3bytes   24 bit segment physical address
  1724.    05   byte    data access rights, set to 93h
  1725.    06   word    reserved word, must be 0
  1726.  
  1727.  - see   LGDT  SGDT
  1728.  
  1729. :media descriptor byte
  1730. ^Media Descriptor Byte
  1731.  
  1732.  Media Descriptor Byte Layout:
  1733.  
  1734.   │7│6│5│4│3│2│1│0│ IBM Media Descriptor Byte
  1735.    │ │ │ │ │ │ │ └─── 1 = 2 sided, 0 = not 2 sided
  1736.    │ │ │ │ │ │ └──── 1 = 8 sector, 0 = not 8 sector
  1737.    │ │ │ │ │ └───── 1 = removable, 0 = not removable
  1738.    └─┴─┴─┴─┴────── must be set to 1
  1739.  
  1740.  F8   Hard disk
  1741.       Double sided  18 sector diskette   PS2 1.44 Mb. DSQD
  1742.  
  1743.  F9   5¼  Double sided, High Density diskette (15 sector)
  1744.       3½  Double Sided, Double High Density diskette (9 sector)
  1745.  
  1746.  FA   Ram disk (not all Ramdisks use this)
  1747.  
  1748.  FC   5¼ Single Sided, Double Density diskette (9 sector)
  1749.       8  inch Double Sided, Single Density diskette
  1750.  
  1751.  FD   5¼ Double Sided, Double Density (9 sector)
  1752.       8  inch Double Sided Single Density (26 sector) (IBM 3740
  1753.          format) 128 bytes per sector, soft sector, 4 sectors
  1754.          cluster, 4 reserved sectors, 2 FATs, 68 directory entries,
  1755.          77*26*2 sectors.
  1756.  
  1757.  FE   5¼ Single Sided, Double Density diskette (8 sector)
  1758.       8  inch Single Sided, Single Density diskette (26 sector)
  1759.          (IBM 3740 format) 128 bytes per sector, soft sector,
  1760.          4 sectors per cluster, 1 reserved sector, 2 FATs. 68
  1761.          directory entries, 77*26 sectors.
  1762.       8  inch Double Sided, Double Density (8 sector), 1024 bytes
  1763.          per sector, soft sector, 1 sector per cluster, 1 reserved
  1764.          sector, 2 FATs, 192 directory entries, 77*8*2 sectors. To
  1765.          distinguish from 8 inch SS/SD attempt read of side 2.
  1766.  
  1767.  FF   5¼ Double Sided, Double Density diskette (8 sector)
  1768.  
  1769.  - see also   INT 21,1B   INT 21,1C   FAT
  1770. :memory control block:mcb
  1771. ^MCB - DOS Memory Control Block Format
  1772.  
  1773. %Offset Size             Description
  1774.  
  1775.    00   byte   'M' 4Dh  member of a MCB chain, (not last)
  1776.                'Z' 5Ah  indicates last entry in MCB chain
  1777.                other values cause "Memory Allocation Failure" on exit
  1778.    01   word   PSP segment address of MCB owner (Process Id)
  1779.                possible values:
  1780.                   0 = free
  1781.                   8 = Allocated by DOS before first user pgm loaded
  1782.                   other = Process Id/PSP segment address of owner
  1783.    03   word   number of paras related to this MCB (excluding MCB)
  1784.    05 11bytes  reserved
  1785.    08  8bytes  ASCII program name, NULL terminated if less than max
  1786.                length (DOS 4.x+)
  1787.    10  nbytes  first byte of actual allocated memory block
  1788.  
  1789.  
  1790.  - to find the first MCB in the chain, use  INT 21,52
  1791.  - DOS 3.1+ the first memory block contains the DOS data segment
  1792.    ie., installable drivers, buffers, etc
  1793.  - DOS 4.x the first memory block is divided into subsegments,
  1794.    with their own memory control blocks; offset 0000h is the first
  1795.  - the 'M' and 'Z' are said to represent Mark Zbikowski
  1796.  
  1797.  
  1798. ^DOS 4.x Initial Data Segment Subsegment Control Blocks:
  1799.  
  1800. %Offset Size       Description
  1801.    00   byte  subsegment type
  1802.                'D'  device driver
  1803.                'E'  device driver appendage
  1804.                'I'  Installable File System driver
  1805.                'F'  FILES= control block storage area (for FILES>5)
  1806.                'X'  FCBS= control block storage area, if present
  1807.                'C'  BUFFERS EMS workspace area if BUFFERS /X is used
  1808.                'B'  BUFFERS= storage area
  1809.                'L'  LASTDRIVE= current directory structure array
  1810.                'S'  STACKS= code/data area, if present (see below)
  1811.    01   word  paragraph of subsegment start
  1812.    03   word  subsegment size in paragraphs
  1813.    05  3bytes unused
  1814.    08         types "D" and "I", filename of driver loaded driver
  1815.  
  1816.  
  1817.  - see also INT 21,48    INT 21,49    INT 21,4A    INT 21,52
  1818.  
  1819. :program segment prefix:psp
  1820. ^PSP - DOS Program Segment Prefix Layout
  1821.  
  1822. %Offset Size           Description
  1823.  
  1824.   00   word    machine code INT 20 instruction (CDh 20h)
  1825.   02   word    top of memory in segment (paragraph) form
  1826.   04   byte    reserved for DOS, usually 0
  1827.   05  5bytes   machine code instruction long call to the DOS
  1828.                function dispatcher (obsolete)
  1829.   06   word    .COM programs bytes available. in segment
  1830.   0A   dword   INT 22h terminate address;  DOS loader jumps to this
  1831.                address upon exit;  the EXEC function forces a child
  1832.                process to return to the parent by setting this
  1833.                vector to code within the parent (IP,CS)
  1834.   0E   dword   INT 23h Ctrl-Break exit address; the original INT 23h
  1835.                vector is NOT restored from this pointer (IP,CS)
  1836.   12   dword   INT 24h critical error exit address; the original
  1837.                INT 24h vector is NOT restored from this field (IP,CS)
  1838.   16   word    parent process segment addr (Undoc. DOS 2.x+)
  1839.                COMMAND.COM has a parent id of zero, or its own PSP
  1840.   18  20bytes  file handle array (Undocumented DOS 3.x+); if handle
  1841.                array element is FF then handle is available
  1842.   2C   word    segment address of the environment, or zero
  1843.   2E   dword   reserved for DOS
  1844.   32   word    handle array size (Undocumented DOS 3.x+)
  1845.   34   dword   handle array pointer (Undocumented DOS 3.x+)
  1846.   38  36bytes  reserved for DOS
  1847.   5C  36bytes  default unopened FCB #1 (parts overlayed by FCB #2)
  1848.   6C  20bytes  default unopened FCB #2 (overlays part of FCB #1)
  1849.   80   byte    count of characters in command tail;  all bytes
  1850.                following command name;  also default DTA (128 bytes);
  1851.                program name and complete path can be found following
  1852.                the environment in DOS 3.0+
  1853.   81 127bytes  all characters entered after the program name
  1854.  
  1855.  
  1856.  - see also  INT 21,52  for information on finding the first MCB
  1857.  
  1858. :scan codes
  1859. ^INT 16 - Keyboard Scan Codes
  1860.  
  1861. %Key      Normal    Shifted   w/Ctrl    w/Alt
  1862.  
  1863.   A        1E61      1E41      1E01      1E00
  1864.   B        3062      3042      3002      3000
  1865.   C        2E63      2E42      2E03      2E00
  1866.   D        2064      2044      2004      2000
  1867.   E        1265      1245      1205      1200
  1868.   F        2166      2146      2106      2100
  1869.   G        2267      2247      2207      2200
  1870.   H        2368      2348      2308      2300
  1871.   I        1769      1749      1709      1700
  1872.   J        246A      244A      240A      2400
  1873.   K        256B      254B      250B      2500
  1874.   L        266C      264C      260C      2600
  1875.   M        326D      324D      320D      3200
  1876.   N        316E      314E      310E      3100
  1877.   O        186F      184F      180F      1800
  1878.   P        1970      1950      1910      1900
  1879.   Q        1071      1051      1011      1000
  1880.   R        1372      1352      1312      1300
  1881.   S        1F73      1F53      1F13      1F00
  1882.   T        1474      1454      1414      1400
  1883.   U        1675      1655      1615      1600
  1884.   V        2F76      2F56      2F16      2F00
  1885.   W        1177      1157      1117      1100
  1886.   X        2D78      2D58      2D18      2D00
  1887.   Y        1579      1559      1519      1500
  1888.   Z        2C7A      2C5A      2C1A      2C00
  1889.  
  1890. %Key      Normal    Shifted   w/Ctrl    w/Alt
  1891.  
  1892.   1        0231      0221                7800
  1893.   2        0332      0340      0300      7900
  1894.   3        0433      0423                7A00
  1895.   4        0534      0524                7B00
  1896.   5        0635      0625                7C00
  1897.   6        0736      075E      071E      7D00
  1898.   7        0837      0826                7E00
  1899.   8        0938      092A                7F00
  1900.   9        0A39      0A28                8000
  1901.   0        0B30      0B29                8100
  1902.  
  1903. %Key      Normal    Shifted   w/Ctrl    w/Alt
  1904.  
  1905.   -        0C2D      0C5F      0C1F      8200
  1906.   =        0D3D      0D2B                8300
  1907.   [        1A5B      1A7B      1A1B      1A00
  1908.   ]        1B5D      1B7D      1B1D      1B00
  1909.   ;        273B      273A                2700
  1910.   '        2827      2822
  1911.   `        2960      297E
  1912.   \        2B5C      2B7C      2B1C      2600 (same as Alt L)
  1913.   ,        332C      333C
  1914.   .        342E      343E
  1915.   /        352F      353F
  1916.  
  1917. %Key      Normal    Shifted   w/Ctrl    w/Alt
  1918.  
  1919.  F1        3B00      5400      5E00      6800
  1920.  F2        3C00      5500      5F00      6900
  1921.  F3        3D00      5600      6000      6A00
  1922.  F4        3E00      5700      6100      6B00
  1923.  F5        3F00      5800      6200      6C00
  1924.  F6        4000      5900      6300      6D00
  1925.  F7        4100      5A00      6400      6E00
  1926.  F8        4200      5B00      6500      6F00
  1927.  F9        4300      5C00      6600      7000
  1928.  F10       4400      5D00      6700      7100
  1929.  F11       8500      8700      8900      8B00
  1930.  F12       8600      8800      8A00      8C00
  1931.  
  1932. %Key         Normal    Shifted   w/Ctrl    w/Alt
  1933.  
  1934.  BackSpace    0E08      0E08      0E7F     0E00
  1935.  Del          5300      532E      9300     A300
  1936.  Down Arrow   5000      5032      9100     A000
  1937.  End          4F00      4F31      7500     9F00
  1938.  Enter        1C0D      1C0D      1C0A     A600
  1939.  Esc          011B      011B      011B     0100
  1940.  Home         4700      4737      7700     9700
  1941.  Ins          5200      5230      9200     A200
  1942.  Keypad 5               4C35      8F00
  1943.  Keypad *     372A                9600     3700
  1944.  Keypad -     4A2D      4A2D      8E00     4A00
  1945.  Keypad +     4E2B      4E2B               4E00
  1946.  Keypad /     352F      352F      9500     A400
  1947.  Left Arrow   4B00      4B34      7300     9B00
  1948.  PgDn         5100      5133      7600     A100
  1949.  PgUp         4900      4939      8400     9900
  1950.  PrtSc                            7200
  1951.  Right Arrow  4D00      4D36      7400     9D00
  1952.  SpaceBar     3920      3920      3920     3920
  1953.  Tab          0F09      0F00      9400     A500
  1954.  Up Arrow     4800      4838      8D00     9800
  1955.  
  1956.  
  1957.  - Some key combinations are not available on all systems.  The PS/2
  1958.    includes many that aren't available on the PC, XT and AT.
  1959.  - To retrieve the character from a scan code logical AND the word
  1960.    with 0x00FF.
  1961.  - see   INT 16   MAKE CODES
  1962. :sft:file table:system file table
  1963. ^System File Table  (Undocumented)
  1964.  
  1965. ^DOS 2.x System File Table Format
  1966.  
  1967. %Offset Size            Description
  1968.  
  1969.    00   dword  pointer to next system file table; offset of ffffh
  1970.                indicates last table in chain
  1971.    04   word   number of file descriptors in table
  1972.    06  nbytes  file descriptor table of the format (40 bytes each):
  1973.  
  1974. %    Offset Size        Description
  1975.  
  1976.        00   byte  count of handles referring to this file or
  1977.                   zero if file is no longer open
  1978.        01   byte  open mode
  1979.        02   byte  file attribute
  1980.        03   byte  drive (1=A, 2=B:, ..., 0=char device)
  1981.        04 11bytes filename in FCB format
  1982.        0F   word  unknown
  1983.        11   word  unknown
  1984.        13   dword file size
  1985.        17   word  file date
  1986.        19   word  file time
  1987.        1B   byte  device attribute
  1988.        1C   dword pointer to device driver (if char device)
  1989.             word  starting cluster of file (block device)
  1990.        1E   word  if block device, relative cluster within file of
  1991.                   the last cluster read; zero if file has never
  1992.                   been read or written
  1993.        20   word  absolute cluster number of current cluster
  1994.        22   word  unknown
  1995.        24   dword current file position
  1996.  
  1997.  
  1998. ^DOS 3.x System File Table and FCB Table Format
  1999.  
  2000. %Offset Size            Description
  2001.  
  2002.    00   dword  pointer to next system file table; offset of ffffh
  2003.                indicates last table in chain
  2004.    04   word   number of file descriptors in table
  2005.    06  nbytes  file descriptor table of the format (53 bytes each):
  2006.  
  2007. %    Offset Size        Description
  2008.  
  2009.        00   word  count of handles referring to this file or
  2010.                   zero if file is no longer open
  2011.        02   word  open mode, bit 15 set if file id opened via FCB
  2012.        04   byte  file attribute
  2013.        05   word  device info word
  2014.        07   dword if char device pointer to device driver header
  2015.                   if block device pointer to DOS Device Control Block
  2016.        0B   word  starting cluster of file
  2017.        0D   word  file time
  2018.        0F   word  file date
  2019.        11   dword file size
  2020.        15   dword current file position
  2021.        19   word  if block device, relative cluster within file of
  2022.                   the last cluster read
  2023.        1B   word  absolute cluster number of last cluster read
  2024.                   zero if file has never been read or written
  2025.        1D   word  sector number containing the directory entry
  2026.        1F   byte  number of dir entry within sector
  2027.        20 11bytes filename in FCB format
  2028.        2B   dword SHARE pointer to previous SFT sharing same file
  2029.        2F   word  SHARE number of network machine opening file
  2030.        31   word  PSP segment of file owner
  2031.        33   word  offset within SHARE code segment of sharing record
  2032.                   0000h = none
  2033.  
  2034.  
  2035. ^DOS 4.0+ System File Table and FCB Table
  2036.  
  2037. %Offset Size            Description
  2038.  
  2039.    00   dword  pointer to next system file table; offset of ffffh
  2040.                indicates last table in chain
  2041.    04   word   number of file descriptors in table
  2042.    06  nbytes  file descriptor table of the format (59 bytes each):
  2043.  
  2044. %    Offset Size        Description
  2045.  
  2046.        00   word   count of handles referring to this file or
  2047.                    zero if file is no longer open
  2048.        02   word   open mode, bit 15 set if file id opened via FCB
  2049.        04   byte   file attribute
  2050.        05   word   device info word
  2051.        07   dword  if char device pointer to device driver header
  2052.                    if block device pointer to DOS Device Control Block
  2053.                    or REDIR data
  2054.        0B   word   starting cluster of file
  2055.        0D   word   file time
  2056.        0F   word   file date
  2057.        11   dword  file size
  2058.        15   dword  current file position
  2059.        19   dword  if network redirector, pointer to REDIRIFS record
  2060.             word   if local block dev, relative cluster within file
  2061.                    of the last cluster read
  2062.        1B   dword  if local, sector number of directory entry
  2063.        1F   byte   if local, number of directory entry within sector
  2064.        20  11bytes filename in FCB format
  2065.        2B   dword  SHARE pointer to previous SFT sharing same file
  2066.        2F   word   SHARE number of network machine opening file
  2067.        31   word   PSP segment of file owner
  2068.        33   word   offset within SHARE code seg of sharing record
  2069.                    0000h = none
  2070.        35   word   absolute cluster number of last cluster read
  2071.                    zero if file has never been read or written
  2072.        37   dword  pointer to file IFS driver, NULL if native DOS
  2073.  
  2074.  
  2075.  - these structures are allocated by DOS during the scanning of the
  2076.    CONFIG.SYS file
  2077.  - INT 21,67 can be used to allow an application to have more than 20
  2078.    file handles;  the total number of handles is limited still to the
  2079.    value of FILES=n in CONFIG.SYS
  2080.  - the structure of these fields is undocumented;  the information
  2081.    provided here is gathered from multiple sources, most notably
  2082.    Bernd Schemmer's MSDOS.DOC and William C. Parkes "Data Structures
  2083.    Used in IBM PC Compatibles and the PS/2".  I do not recommend
  2084.    relying on any of this information, instead use it as an aid
  2085.    in debugging
  2086.  - see   INT 21,52   INT 21,67
  2087.  
  2088. :system descriptor
  2089. ^BIOS System Descriptor Table  (PS2)
  2090.  
  2091. %Offset Size          Description
  2092.  
  2093.    00   word  length of descriptor (8 minimum)
  2094.    02   byte  model byte (same as FFFF:E, not reliable)
  2095.    03   byte  secondary model byte
  2096.    04   byte  BIOS revision level (zero based)
  2097.    05   byte  feature information  (see table)
  2098.    06  dword  reserved
  2099.  
  2100.  
  2101.  │7│6│5│4│3│2│1│0│ feature information at offset 5
  2102.   │ │ │ │ │ │ │ └─── reserved
  2103.   │ │ │ │ │ │ └──── 0=PC bus, 1=Micro Channel
  2104.   │ │ │ │ │ └───── Extended BIOS Data Area allocated
  2105.   │ │ │ │ └────── wait for external event supported
  2106.   │ │ │ └─────── INT 15 AH=4F used (kbd intercept)
  2107.   │ │ └──────── RTC present
  2108.   │ └───────── 2nd 8259 present
  2109.   └────────── DMA channel 3 used by fixed disk BIOS
  2110.  
  2111.  
  2112.  - see also  MACHINE IDENT  and  INT 15,C0
  2113.  
  2114. :video information:video tables
  2115. ^Video Information Tables
  2116.  
  2117. %BIOS Data Area Fields
  2118.  
  2119. %Address Size               Description
  2120.  
  2121.  40:49   byte    Current video mode  (see VIDEO MODE)
  2122.  40:4A   word    Number of screen columns
  2123.  40:4C   word    Size of video regen buffer in bytes
  2124.  40:4E   word    Starting address in video regen buffer (offset)
  2125.  40:50  8 words  Cursor position of pages 1-8, high order
  2126.                  byte=row, low order byte=column
  2127.  40:60   byte    Ending (bottom) scan line for cursor
  2128.  40:61   byte    Starting (top) scan line for cursor
  2129.  40:62   byte    Active display page number
  2130.  40:63   word    Base port address for active 6845 CRT controller
  2131.                  3B4h = mono, 3D4h = color
  2132.  40:65   byte    6845 CRT mode control register value (port 3x8h)
  2133.                  EGA/VGA values emulate those of the MDA/CGA
  2134.  40:66   byte    CGA current color palette setting (port 3d9h)
  2135.                  EGA and VGA values emulate the CGA
  2136.  40:84   byte    Rows on the screen (less 1, EGA+)
  2137.  40:85   word    Point height of character matrix (EGA+)
  2138.  40:87   byte    Video mode options (EGA+)
  2139.  
  2140.      │7│6│5│4│3│2│1│0│ Video mode options (EGA+)
  2141.       │ │ │ │ │ │ │ └── 1=alphanumeric cursor emulation enabled
  2142.       │ │ │ │ │ │ └─── 1=video subsystem attached to monochrome
  2143.       │ │ │ │ │ └──── reserved
  2144.       │ │ │ │ └───── 1=video subsystem is inactive
  2145.       │ │ │ └────── reserved
  2146.       │ └─┴─────── video RAM  00-64K  10-192K  01-128K  11-256K
  2147.       └────────── video mode number passed to INT 10h, function 0
  2148.  
  2149.  40:88   byte    EGA feature bit switches, emulated on VGA
  2150.  
  2151.      │7│6│5│4│3│2│1│0│ EGA feature bit switches (EGA+)
  2152.       │ │ │ │ │ │ │ └── EGA SW1 config (1=off)
  2153.       │ │ │ │ │ │ └─── EGA SW2 config (1=off)
  2154.       │ │ │ │ │ └──── EGA SW3 config (1=off)
  2155.       │ │ │ │ └───── EGA SW4 config (1=off)
  2156.       │ │ │ └────── Input FEAT0 (ISR0 bit 5) after output on FCR0
  2157.       │ │ └─────── Input FEAT0 (ISR0 bit 6) after output on FCR0
  2158.       │ └──────── Input FEAT1 (ISR0 bit 5) after output on FCR1
  2159.       └───────── Input FEAT1 (ISR0 bit 6) after output on FCR1
  2160.  
  2161.  40:89   byte    Video display data area (MCGA and VGA)
  2162.  
  2163.      │7│6│5│4│3│2│1│0│ Video display data area (MCGA and VGA)
  2164.       │ │ │ │ │ │ │ └── 1=VGA is active
  2165.       │ │ │ │ │ │ └─── 1=gray scale is enabled
  2166.       │ │ │ │ │ └──── 1=using monochrome monitor
  2167.       │ │ │ │ └───── 1=default palette loading is disabled
  2168.       │ │ │ └────── see table below
  2169.       │ │ └─────── reserved
  2170.       │ └────────  1=display switching enabled
  2171.       └───────── alphanumeric scan lines (see table below)
  2172.  
  2173.      bit 7   bit 4
  2174.        0       0   350 line mode
  2175.        0       1   400 line mode
  2176.        1       0   200 line mode
  2177.        1       1   reserved
  2178.  
  2179.  40:8A   byte    Display Combination Code (DCC) table index (EGA+)
  2180.  40:A8  dword    BIOS Video Save/Override Pointer Table address
  2181.  
  2182.  
  2183. ^EGA / VGA Related Tables
  2184.  
  2185. %Video Save/Override Pointer Table (pointer at 40:A8):
  2186.  
  2187.  00  dword  Video Parameter Table pointer
  2188.  04  dword  Dynamic Parameter Save Area pointer (EGA, VGA)
  2189.  08  dword  Alphanumeric Character Set Override pointer
  2190.  0C  dword  Graphics Character Set Override pointer
  2191.  10  dword  Secondary Save Pointer Table pointer (VGA)
  2192.  14  dword  reserved, set to 0000:0000
  2193.  18  dword  reserved, set to 0000:0000
  2194.  
  2195.  
  2196. %Video Parameter Table
  2197.  
  2198.  00   byte    number of displayed character columns
  2199.  01   byte    number of displayed screen rows minus 1
  2200.  02   byte    character matrix height in points
  2201.  03   word    video buffer size in bytes
  2202.  05   dword   contents of sequencer registers 1-4
  2203.  09   byte    misc. output register values
  2204.  0A  25bytes  contents of CRTC registers 0-18h
  2205.  23  20bytes  contents of attribute controller regs 0-13h
  2206.  37  9 bytes  contents of graphics controller regs 0-8
  2207.  
  2208.  
  2209. %Dynamic Parameter Save Area
  2210.  
  2211.  00  16bytes   contents of graphics controller pallette regs
  2212.  10    byte    contents of graphics controller overscan reg
  2213.  11  239bytes  reserved
  2214.  
  2215.  
  2216. %Alphanumeric Character Set Override
  2217.  
  2218.  00   byte    length of each character definition in bytes
  2219.  01   byte    character generator RAM bank
  2220.  02   word    count of characters defined
  2221.  04   word    first character code in table
  2222.  06   dword   pointer to character font definition table
  2223.  0A   byte    number of character rows displayed
  2224.  0B   nbytes  array of applicable video modes
  2225.  0B+n byte    FFh end of mode list marker
  2226.  
  2227.  
  2228. %Graphics Character Set Override
  2229.  
  2230.  00   byte    count of displayed character rows
  2231.  01   word    length of each character definition in bytes
  2232.  03   dword   pointer to character font definition table
  2233.  07   nbytes  array of applicable video modes
  2234.  07+n byte    FFh end of mode list marker
  2235.  
  2236.  
  2237. %Secondary Save Pointer Table
  2238.  
  2239.  00  word   length of table in bytes
  2240.  02  dword  pointer to display combination code table
  2241.  06  dword  pointer to secondary alphanumeric char set override
  2242.  0A  dword  pointer to user palette profile table  (VGA)
  2243.  0E  dword  reserved
  2244.  12  dword  reserved
  2245.  16  dword  reserved
  2246.  
  2247.  
  2248. %Display Combination Code Table
  2249.  
  2250.  00   byte   number of table entries
  2251.  01   byte   DCC table version number
  2252.  02   byte   maximum display type code
  2253.  03   byte   reserved
  2254.  04  n words array valid display combinations:
  2255.  
  2256.      0,0 entry  0  no display
  2257.      0,1 entry  1  MDPA
  2258.      0,2 entry  2  CGA
  2259.      2,1 entry  3  MDPA + CGA
  2260.      0,4 entry  4  EGA
  2261.      4,1 entry  5  EGA + MDPA
  2262.      0,5 entry  6  MEGA
  2263.      2,5 entry  7  MEGA + CGA
  2264.      0,6 entry  8  PGC
  2265.      1,6 entry  9  PGC + MDPA
  2266.      5,6 entry 10  PGC + MEGA
  2267.      0,8 entry 11  CVGA
  2268.      1,8 entry 12  CVGA + MDPA
  2269.      0,7 entry 13  MVGA
  2270.      2,7 entry 14  MVGA + CGA
  2271.      2,6 entry 15  MVGA + PGC
  2272.  
  2273.  
  2274. %Secondary Alpha Mode Auxillary Character Generator Table
  2275.  
  2276.  00   byte    bytes per character
  2277.  01   byte    block to load
  2278.  02   byte    reserved
  2279.  03   dword   font table pointer
  2280.  07   nbytes  array of mode values for this font
  2281.  07+n byte    FFh end of mode list marker
  2282.  
  2283.  
  2284. %Palette Profile Table (VGA only)
  2285.  
  2286.  00   byte    1 - enable underlining in all alphanumeric modes
  2287.               0 - enable underlining in monochrome alpha modes
  2288.              -1 - disable underlining in all alpha modes
  2289.  01   byte   reserved
  2290.  02   word   reserved
  2291.  04   word   count of attribute controller regs in table
  2292.  06   word   first attribute controller register number
  2293.  08   dword  pointer to attribute controller reg table
  2294.  0C   word   count of video DAC color registers in table
  2295.  0E   word   first video DAC color register number
  2296.  10   dword  video DAC color register table pointer
  2297.  14   nbytes array of applicable video modes for this font
  2298.  14+n byte   FFh end of video mode list marker
  2299.  
  2300.  
  2301.  - see also BIOS DATA AREA
  2302.  - see INT 10,1B for Dynamic Video State Table and Video Static
  2303.    Functionality Table
  2304.  
  2305. :video pages
  2306. ^Video modes and corresponding number of pages
  2307.  
  2308.   00 - pages 0-7  (CGA,EGA,MCGA,VGA)
  2309.   01 - pages 0-7  (CGA,EGA,MCGA,VGA)
  2310.   02 - pages 0-3  (CGA)
  2311.        pages 0-7  (EGA,MCGA,VGA)
  2312.   03 - pages 0-3  (CGA)
  2313.        pages 0-7  (EGA,MCGA,VGA)
  2314.   07 - pages 0-7  (EGA,VGA)
  2315.        no pages   (MDA)
  2316.   0D - pages 0-7  (EGA,VGA)
  2317.   0E - pages 0-4  (EGA,VGA)
  2318.   0F - pages 0-1  (EGA,VGA)
  2319.   10 - pages 0-1  (EGA,VGA)
  2320.  
  2321. :xfcb:extended fcb:extended file ctlblk
  2322. ^XFCB - Extended DOS File Control Block
  2323.  
  2324. %Offset Size             Description
  2325.  
  2326.    00   byte   flag containing FF if this is an extended FCB
  2327.    01  5bytes  reserved
  2328.    06   byte   directory attribute byte  (see FILE ATTRIBUTE)
  2329.    07   byte   drive number (0 for default drive, 1 = A:, 2 = B:)
  2330.    08  8bytes  filename, left justified with trailing blanks
  2331.    16  3bytes  filename extension, left justified w/blanks
  2332.    19   word   current block number relative to file start (0 based)
  2333.    21   word   logical record size in bytes
  2334.    23   dword  file size in bytes
  2335.    27   word   date the file was created or last updated:
  2336.  
  2337.       │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 21,20
  2338.        │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─ day 1-31
  2339.        │ │ │ │ │ │ │ └─┴─┴─┴────────── month 1-12
  2340.        └─┴─┴─┴─┴─┴─┴───────────────── year + 1980
  2341.  
  2342.    29 16bytes  reserved for system use
  2343.    39   byte   relative record number within current BLOCK
  2344.    40  4bytes  relative record number from start of file (0 based)
  2345.  
  2346.